本帖最后由 15106970607 于 2025-3-11 23:28 编辑
跌跌撞撞的成长,又美又疼才是本质。

import win.ui;
/*DSG{{*/
mainForm = win.form(text="循环实例";right=676;bottom=427;max=false)
mainForm.add(
button1={cls="button";text="开始";left=48;top=339;right=148;bottom=389;z=1};
button2={cls="button";text="暂停";left=206;top=339;right=306;bottom=389;z=2};
button3={cls="button";text="继续";left=363;top=339;right=463;bottom=389;z=3};
button4={cls="button";text="结束";left=521;top=339;right=621;bottom=389;z=4};
static={cls="static";text="0";left=139;top=148;right=539;bottom=198;align="center";font=LOGFONT(h=-29);transparent=1;z=5}
)
/*}}*/
var a,b,c= 0,0,0;
mainForm.button1.oncommand = function(id,event){
//此if:按下结束 再按开始时 abc值全部归零
//方便再次开始
if(c = 1){
a,b,c= 0,0,0
}
while(true){
if b break
if c break
mainForm.static.text = a
a++
win.delay(100)
}
}
mainForm.button2.oncommand = function(id,event){
//此if: 防止程序一开先点一下继续 点开始就没有反映了
if(a != 0){
b = 1
}
}
mainForm.button3.oncommand = function(id,event){
//给暂停键值归零 方便暂停后再继续
b = 0
while(true){
if b break
if c break
win.delay(100)
mainForm.static.text = a
a++
}
}
mainForm.button4.oncommand = function(id,event){
c= 1
mainForm.static.text = 0
}
mainForm.show();
return win.loopMessage();