当窗口中有多个组件排列显示,一个窗口容纳不下时,需要滚动显示。
显示效果
以下为实现代码:
import win.ui;
/*DSG{{*/
var winform = win.form(text="aardio form";right=759;bottom=469)
winform.add(
custom={cls="custom";text="自定义控件";left=8;top=8;right=400;bottom=464;z=1}
)
/*}}*/
winform.show();
..dpi= winform.dpiScaleY
for(i=0;7;1){
var ty = ..dpi+i*180*..dpi;
var th = ty + 30*..dpi;
var py = ty + 30*..dpi;
var ph = py + 150*..dpi
var title = i+1++"队";
winform.custom.addCtrl(
["title"++i+2] = {cls="plus";text=title;left=0;top=ty;right=268;bottom=th;align="left";bgcolor=16711808;color=16777215;font=LOGFONT(h=-16;weight=700);forecolor=255;linearGradient=45;notify=1;textPadding={left=10};z=i};
["plus"++i+2] = {cls="plus";left=0;top=py;right=268;bottom=ph;ah=1;autohscroll=false;bgcolor=0xFFFFFFFF;autovscroll=false;aw=1;db=1;dl=1;dr=1;dt=1;notify=1;z=i}
)
}
import win.ui.scrollbar
var sc = win.ui.scrollbar(winform.custom,true)
sc.setRange(1,winform.custom.plus9.bottom - winform.custom.height)
win.loopMessage();