
import win.ui;
import console;
/*DSG{{*/
var winform = win.form(text="批量生成按钮实例";right=759;bottom=469;bgcolor=15780518)
winform.add(
custom={cls="custom";text="自定义控件";left=10;top=10;right=749;bottom=455;bgcolor=15780518;z=1}
)
/*}}*/
//aardio批量生成动态按钮实例
//做3个按钮,第1个,右1,下1
//得到第一个按钮位置,左右上下间距
left,right,top,bottom = 38,158,36,88
toRight = 138
toBottom = 72
rows,cols = 5,5; //行,列
buttonTab = {}; //批量生成位置
for(i=1;rows;1){ //行
	for(j=1;cols;1){ //列
		table.push(buttonTab,{
			left+(j-1)*toRight,right+(j-1)*toRight,
			top+(i-1)*toBottom,bottom+(i-1)*toBottom
		})
	}
}
//console.dump(buttonTab)
for(i=1;rows*cols;1){ //动态生成控件
	left,right,top,bottom = table.unpack(buttonTab[i]);
    //winform.add(
    winform.custom.addCtrl(
		['button'+i]={cls="button";text="按钮"++i;
			left=left;top=top;right=right;
			bottom=bottom;z=1};
	)
    winform.custom['button'+i].oncommand = function(id,event){
		winform.msgbox(owner.text)
	}
}
winform.show();
win.loopMessage();
这个原生模型,简单易用,是受到99乘法表的启发,形成的模型思想,可修改cls为plus,美化样式