代码简化
$box1= GUICtrlCreateCheckbox("OFFICE2007", 40, 140, 100, 20)GUICtrlSetFont($box1,12)
$box2=GUICtrlCreateCheckbox("RTX",220,140,50,20)
GUICtrlSetFont($box2,12)
$box3=GUICtrlCreateCheckbox("FOXMAIL",330,140,70,20)
GUICtrlSetFont($box3,12)
$box4=GUICtrlCreateCheckbox("viso2007",40,180,85,20)
GUICtrlSetFont($box4,12)
$box5=GUICtrlCreateCheckbox("PS",220,180,35,20)
GUICtrlSetFont($box5,12)
$box6=GUICtrlCreateCheckbox("火狐",330,180,50,20)
GUICtrlSetFont($box6,12)
$box7=GUICtrlCreateCheckbox("遨游",40,220,50,20)
GUICtrlSetFont($box7,12)
$box8=GUICtrlCreateCheckbox("电信传真",220,220,85,20)
GUICtrlSetFont($box8,12)
$gui=GUICtrlCreateLabel("",60,280,80,30)
GUICtrlSetData($gui,_NowDate())
GUICtrlSetFont($gui,12)
$gui2=GUICtrlCreateLabel("",200,280,80,30)
GUICtrlSetFont($gui2,12)
$gui3=GUICtrlCreateLabel("",320,280,50,30)
GUICtrlSetData($gui3,$week[@WDAY-1])
GUICtrlSetFont($gui3,12)
这段修改字体的代码可以简化否? 下面试试看
记得Execute可以这样用
$box1= GUICtrlCreateCheckbox("OFFICE2007", 40, 140, 100, 20)
$box2=GUICtrlCreateCheckbox("RTX",220,140,50,20)
$box3=GUICtrlCreateCheckbox("FOXMAIL",330,140,70,20)
$box4=GUICtrlCreateCheckbox("viso2007",40,180,85,20)
$box5=GUICtrlCreateCheckbox("PS",220,180,35,20)
$box6=GUICtrlCreateCheckbox("火狐",330,180,50,20)
$box7=GUICtrlCreateCheckbox("遨游",40,220,50,20)
$box8=GUICtrlCreateCheckbox("电信传真",220,220,85,20)
$gui1=GUICtrlCreateLabel("",60,280,80,30)
GUICtrlSetData($gui,_NowDate())
$gui2=GUICtrlCreateLabel("",200,280,80,30)
$gui3=GUICtrlCreateLabel("",320,280,50,30)
GUICtrlSetData($gui3,$week[@WDAY-1])
For $i=1 To 8
Execute("GUICtrlSetFont($box" & $i & ",12)")
Next
For $i=1 To 3
Execute("GUICtrlSetFont($gui" & $i & ",12)")
Next
或
Dim $Col=["box1","box2","box3","box4","box5","box6","box7","box8","gui","gui2","gui3"]
$box1= GUICtrlCreateCheckbox("OFFICE2007", 40, 140, 100, 20)
$box2=GUICtrlCreateCheckbox("RTX",220,140,50,20)
$box3=GUICtrlCreateCheckbox("FOXMAIL",330,140,70,20)
$box4=GUICtrlCreateCheckbox("viso2007",40,180,85,20)
$box5=GUICtrlCreateCheckbox("PS",220,180,35,20)
$box6=GUICtrlCreateCheckbox("火狐",330,180,50,20)
$box7=GUICtrlCreateCheckbox("遨游",40,220,50,20)
$box8=GUICtrlCreateCheckbox("电信传真",220,220,85,20)
$gui=GUICtrlCreateLabel("",60,280,80,30)
GUICtrlSetData($gui,_NowDate())
$gui2=GUICtrlCreateLabel("",200,280,80,30)
$gui3=GUICtrlCreateLabel("",320,280,50,30)
GUICtrlSetData($gui3,$week[@WDAY-1])
For $i=0 To 10
Execute("GUICtrlSetFont($" & $Col[$i] & ",12)")
Next
$a=谢谢了,
"非常" & $a $a=谢谢了,
"非常" & $a 支持数量较多并有一定规律的控件创建,管理.
#include <array.au3>
$gui=GUICreate("测试")
local $box_text=["OFFICE2007","RTX","FOXMAIL","viso2007","PS","火狐","遨游","电信传真","OFFICE2007","RTX","FOXMAIL","viso2007","PS","火狐","遨游"]
local $box
local $k=0
for $n=0 to int((UBound($box)-1)/3)
for $i=0 to 2
if $k>UBound($box_text)-1 then ExitLoop(2)
$box[$k]=GUICtrlCreateCheckbox($box_text[$k], 40+$i*110, 140+$n*45, 100, 20)
$k+=1
Next
Next
$gui1=GUICtrlCreateLabel("",60,280,80,30)
;GUICtrlSetData($gui,_NowDate())
$gui2=GUICtrlCreateLabel("",200,280,80,30)
$gui3=GUICtrlCreateLabel("",320,280,50,30)
for $i=0 to UBound($box)-1
GUICtrlSetFont($box[$i],12)
Next
GUISetState()
;GUICtrlSetData($gui3,$week[@WDAY-1])
While 1
$msg=GUIGetMsg()
if $msg=-3 then Exit
WEnd 本帖最后由 netegg 于 2011-2-14 22:33 编辑
GUISetFont(12) 学习了。。。。
页:
[1]