参见代码。有方法的朋友请出手帮忙!
#include <GUIConstants.au3>
Dim $okDDgiu_Label[21],$okDDgiu_Input[21],$okDDgiu_Checkbox[21]
$okDDgiu = GUICreate("测试", 633, 515, -1, 0, BitOR($WS_CAPTION, $WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS))
$okDDgiu_Label[1] = GUICtrlCreateLabel("Label1", 34, 64, 100, 34)
$okDDgiu_Label[2] = GUICtrlCreateLabel("Label2", 34, 96, 100, 34)
$okDDgiu_Label[3] = GUICtrlCreateLabel("Label3", 34, 128, 100, 34)
$okDDgiu_Label[4] = GUICtrlCreateLabel("Label4", 34, 160, 100, 34)
$okDDgiu_Label[5] = GUICtrlCreateLabel("Label5", 34, 192, 100, 34)
$okDDgiu_Label[6] = GUICtrlCreateLabel("Label6", 34, 224, 100, 34)
$okDDgiu_Label[7] = GUICtrlCreateLabel("Label7", 34, 256, 100, 34)
$okDDgiu_Label[8] = GUICtrlCreateLabel("Label8", 34, 288, 100, 34)
$okDDgiu_Label[9] = GUICtrlCreateLabel("Label9", 34, 320, 100, 34)
$okDDgiu_Label[10] = GUICtrlCreateLabel("Label10", 34, 352, 100, 34)
$okDDgiu_Label[11] = GUICtrlCreateLabel("Label11", 296, 64, 100, 34)
$okDDgiu_Label[12] = GUICtrlCreateLabel("Label12", 296, 96, 100, 34)
$okDDgiu_Label[13] = GUICtrlCreateLabel("Label13", 296, 128, 100, 34)
$okDDgiu_Label[14] = GUICtrlCreateLabel("Label14", 296, 160, 100, 34)
$okDDgiu_Label[15] = GUICtrlCreateLabel("Label15", 296, 192, 100, 34)
$okDDgiu_Label[16] = GUICtrlCreateLabel("Label16", 296, 224, 100, 34)
$okDDgiu_Label[17] = GUICtrlCreateLabel("Label17", 296, 256, 100, 34)
$okDDgiu_Label[18] = GUICtrlCreateLabel("Label18", 296, 288, 100, 34)
$okDDgiu_Label[19] = GUICtrlCreateLabel("Label19", 296, 320, 100, 34)
$okDDgiu_Label[20] = GUICtrlCreateLabel("Label20", 296, 352, 100, 34)
$okDDgiu_Input[1] = GUICtrlCreateCombo("请选择", 112, 56, 121, 21)
$okDDgiu_Input[2] = GUICtrlCreateCombo("请选择", 112, 88, 121, 21)
$okDDgiu_Input[3] = GUICtrlCreateCombo("请选择", 112, 120, 121, 21)
$okDDgiu_Input[4] = GUICtrlCreateCombo("请选择", 112, 152, 121, 21)
$okDDgiu_Input[5] = GUICtrlCreateCombo("请选择", 112, 184, 121, 21)
$okDDgiu_Input[6] = GUICtrlCreateCombo("请选择", 112, 216, 121, 21)
$okDDgiu_Input[7] = GUICtrlCreateCombo("请选择", 112, 248, 121, 21)
$okDDgiu_Input[8] = GUICtrlCreateCombo("请选择", 112, 280, 121, 21)
$okDDgiu_Input[9] = GUICtrlCreateCombo("请选择", 112, 312, 121, 21)
$okDDgiu_Input[10] = GUICtrlCreateCombo("请选择", 112, 344, 121, 21)
$okDDgiu_Input[11] = GUICtrlCreateCombo("请选择", 408, 56, 121, 21)
$okDDgiu_Input[12] = GUICtrlCreateCombo("请选择", 408, 88, 121, 21)
$okDDgiu_Input[13] = GUICtrlCreateCombo("请选择", 408, 120, 121, 21)
$okDDgiu_Input[14] = GUICtrlCreateCombo("请选择", 408, 152, 121, 21)
$okDDgiu_Input[15] = GUICtrlCreateCombo("请选择", 408, 184, 121, 21)
$okDDgiu_Input[16] = GUICtrlCreateCombo("请选择", 408, 216, 121, 21)
$okDDgiu_Input[17] = GUICtrlCreateCombo("请选择", 408, 248, 121, 21)
$okDDgiu_Input[18] = GUICtrlCreateCombo("请选择", 408, 280, 121, 21)
$okDDgiu_Input[19] = GUICtrlCreateCombo("请选择", 408, 312, 121, 21)
$okDDgiu_Input[20] = GUICtrlCreateCombo("请选择", 408, 344, 121, 21)
$okDDgiu_Button1 = GUICtrlCreateButton("确认", 152, 464, 75, 33, 0)
$okDDgiu_Button2 = GUICtrlCreateButton("关闭", 400, 464, 75, 33, 0)
$okDDgiu_Edit1 = GUICtrlCreateEdit("", 112, 384, 417, 73)
$okDDgiu_Label21 = GUICtrlCreateLabel("备注:", 34, 416, 43, 17)
$okDDgiu_Checkbox[1] = GUICtrlCreateCheckbox("", 240, 56, 17, 17)
$okDDgiu_Checkbox[2] = GUICtrlCreateCheckbox("", 240, 88, 17, 17)
$okDDgiu_Checkbox[3] = GUICtrlCreateCheckbox("", 240, 120, 17, 17)
$okDDgiu_Checkbox[4] = GUICtrlCreateCheckbox("", 240, 152, 17, 17)
$okDDgiu_Checkbox[5] = GUICtrlCreateCheckbox("", 240, 184, 17, 17)
$okDDgiu_Checkbox[6] = GUICtrlCreateCheckbox("", 240, 216, 17, 17)
$okDDgiu_Checkbox[7] = GUICtrlCreateCheckbox("", 240, 248, 17, 17)
$okDDgiu_Checkbox[8] = GUICtrlCreateCheckbox("", 240, 280, 17, 17)
$okDDgiu_Checkbox[9] = GUICtrlCreateCheckbox("", 240, 312, 17, 17)
$okDDgiu_Checkbox[10] = GUICtrlCreateCheckbox("", 240, 344, 17, 17)
$okDDgiu_Checkbox[11] = GUICtrlCreateCheckbox("", 536, 56, 17, 17)
$okDDgiu_Checkbox[12] = GUICtrlCreateCheckbox("", 536, 88, 17, 17)
$okDDgiu_Checkbox[13] = GUICtrlCreateCheckbox("", 536, 120, 17, 17)
$okDDgiu_Checkbox[14] = GUICtrlCreateCheckbox("", 536, 152, 17, 17)
$okDDgiu_Checkbox[15] = GUICtrlCreateCheckbox("", 536, 184, 17, 17)
$okDDgiu_Checkbox[16] = GUICtrlCreateCheckbox("", 536, 216, 17, 17)
$okDDgiu_Checkbox[17] = GUICtrlCreateCheckbox("", 536, 248, 17, 17)
$okDDgiu_Checkbox[18] = GUICtrlCreateCheckbox("", 536, 280, 17, 17)
$okDDgiu_Checkbox[19] = GUICtrlCreateCheckbox("", 536, 312, 17, 17)
$okDDgiu_Checkbox[20] = GUICtrlCreateCheckbox("", 536, 344, 17, 17)
$okDDgiu_Label21 = GUICtrlCreateLabel("类型:", 32, 8, 31, 17)
$okDDgiu_Label22 = GUICtrlCreateLabel("非配套下单", 72, 8, 64, 17)
$okDDgiu_Label23 = GUICtrlCreateLabel("部件名称", 32, 32, 52, 17)
$okDDgiu_Label24 = GUICtrlCreateLabel("数量(单位:PCS)", 120, 32, 91, 17)
$okDDgiu_Label25 = GUICtrlCreateLabel("配/不配", 224, 32, 45, 17)
$okDDgiu_Label26 = GUICtrlCreateLabel("部件名称", 296, 32, 52, 17)
$okDDgiu_Label27 = GUICtrlCreateLabel("数量(单位:PCS)", 416, 32, 91, 17)
$okDDgiu_Label28 = GUICtrlCreateLabel("配/不配", 520, 32, 45, 17)
GUISetState(@SW_SHOW)
#EndRegion ### START Koda GUI section ### Form=C:\Documents and Settings\Administrator\桌面\Form3.kxf
While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE Or $nMsg =$okDDgiu_Button2
Exit
Case $nMsg = $okDDgiu_Checkbox[1];后面还有$okDDgiu_Checkbox[1-20]请问如何简化?不可能这样重复代码吧?请有方法的朋友出手。多谢
If BitAND(GUICtrlRead($okDDgiu_Checkbox[1]), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($okDDgiu_Input[1], $GUI_ENABLE)
GUICtrlSetData($okDDgiu_Input[1], "")
GUICtrlSetState($okDDgiu_Label[1], $GUI_ENABLE)
Else
GUICtrlSetState($okDDgiu_Input[1], $GUI_DISABLE)
GUICtrlSetData($okDDgiu_Input[1], "")
GUICtrlSetState($okDDgiu_Label[1], $GUI_DISABLE)
EndIf
EndSelect
WEnd
[ 本帖最后由 华杰 于 2008-6-3 19:45 编辑 ] |