请升级 customPlus 库到最新版本,不低于 V5.0 !


import win.ui;
import fonts.fontAwesome
import win.dlg.message
/*DSG{{*/
var winform = win.form(text="aardio form";right=431;bottom=391)
winform.add(
button={cls="button";text="随机值1";left=16;top=336;right=136;bottom=376;z=2};
button2={cls="button";text="随机值2";left=144;top=336;right=264;bottom=376;z=3};
button3={cls="button";text="动画演示";left=280;top=336;right=400;bottom=376;z=4};
plus={cls="plus";left=17;top=16;right=417;bottom=316;bgcolor=0xC0DCC0;dl=1;dt=1;notify=1;z=1}
)
/*}}*/
winform.show();
import godking.customPlus
var itemModel = {};
//增加四个圆形进度条元素
for(i=1;4;1){
table.push(itemModel,{
type="rect",
name = "p"++i;
round=-1, //圆形
rectf={x=(i-1)*100;y=0;width=100;height=100},
inflate=-10;
fillcolor=0xFFF5DEB3,
color=0xFF000000;
width=1;
progresscolor=0xFF32CD32;
progressdirection=({"left","right","up","down"})[i];
progress=i/5;
})
}
//增加四个圆角矩形进度条元素
for(i=1;4;1){
table.push(itemModel,{
type="rect",
name = "p"++(i+4);
round=20, //圆角矩形
rectf={x=(i-1)*100;y=100;width=100;height=100},
inflate=-10;
fillcolor=0xFFF5DEB3,
color=0xFF000000;
width=1;
progresscolor=0xFF32CD32;
progressdirection=({"left","right","up","down"})[i];
progress=i/5;
})
}
//增加四个矩形进度条元素
for(i=1;4;1){
table.push(itemModel,{
type="rect",
name = "p"++(i+8);
round=0, //矩形
rectf={x=(i-1)*100;y=200;width=100;height=100},
inflate=-10;
fillcolor=0xFFF5DEB3,
color=0xFF000000;
width=1;
progresscolor=0xFF32CD32;
progressdirection=({"left","right","up","down"})[i];
progress=i/5;
})
}
//加入进度文字显示
for(i=1;12;1){
table.push(itemModel,{
type="text",
name = "t"++i;
rectf=itemModel[i].rectf,
inflate=itemModel[i].inflate;
font = ::LOGFONT(name="Tahoma";point=12;color=0xFF0000FF);
align=1;
valign=1;
text = itemModel[i].progress*100++"%"
})
}
//创建customPlus
import godking.customPlus
var p = godking.customPlus(winform.plus/*plus*/,itemModel,{{}},{
itemWidth=500, /*项目宽度*/
itemHeight=300, /*项目高度*/
colnum=1, /*项目列数,为0则根据项目宽度和plus宽度自动计算*/
rownum=1, /*项目行数,为0则根据项目高度和plus高度自动计算*/
})
winform.button.oncommand = function(id,event){
for(i=1;12;1){
var v = ..math.random(0,10000);
p.itemList[1]["p"++i] = v/10000;
p.itemList[1]["t"++i] = v/100++"%";
}
p.update()
}
winform.button2.oncommand = function(id,event){
for(i=1;12;1){
var v = ..math.random(0,10000);
p.itemList[1]["p"++i] = { progresscolor=gdi.ARGB(math.random(100,200),math.random(100,200),math.random(100,200),255);
progress = v/10000 };
p.itemList[1]["t"++i] = { font = ::LOGFONT(name="Tahoma";point=12;color=gdi.ARGB(math.random(0,255),math.random(0,255),math.random(0,255),255));
text = v/100++"%" };
}
p.update();
}
winform.button3.oncommand = function(id,event){
winform.button.disabled = true
winform.button2.disabled = true
for(n=1;100;1){
for(i=1;12;1){
p.itemList[1]["p"++i] = n/100;
p.itemList[1]["t"++i] = n++"%";
}
p.update();
win.delay(1);
}
winform.button.disabled = false
winform.button2.disabled = false
}
win.loopMessage();