找回密码
 加入
搜索
查看: 7221|回复: 12

[AU3基础] 如何批量添加复选框且分行排列[已解决]

  [复制链接]
发表于 2013-3-10 17:36:10 | 显示全部楼层 |阅读模式
本帖最后由 872777825 于 2013-3-10 22:13 编辑




如上图

小弟想这样体检一批复选框  有没有好的办法可以批量添加
而不需要一个个定位添加呢
$B1box[01] = GUICtrlCreateCheckbox("", 288, 188, 13, 13)
$B1box[02] = GUICtrlCreateCheckbox("", 437, 188, 13, 13)
$B1box[03] = GUICtrlCreateCheckbox("", 586, 188, 13, 13)
$B1box[04] = GUICtrlCreateCheckbox("", 735, 188, 13, 13)
$B1box[05] = GUICtrlCreateCheckbox("", 288, 277, 13, 13)
$B1box[06] = GUICtrlCreateCheckbox("", 437, 277, 13, 13)
$B1box[07] = GUICtrlCreateCheckbox("", 586, 277, 13, 13)
$B1box[08] = GUICtrlCreateCheckbox("", 735, 277, 13, 13)
$B1box[09] = GUICtrlCreateCheckbox("", 288, 366, 13, 13)
$B1box[10] = GUICtrlCreateCheckbox("", 437, 366, 13, 13)
$B1box[11] = GUICtrlCreateCheckbox("", 586, 366, 13, 13)
$B1box[12] = GUICtrlCreateCheckbox("", 735, 366, 13, 13)
$B1box[13] = GUICtrlCreateCheckbox("", 288, 455, 13, 13)
$B1box[14] = GUICtrlCreateCheckbox("", 437, 455, 13, 13)
$B1box[15] = GUICtrlCreateCheckbox("", 586, 455, 13, 13)
$B1box[16] = GUICtrlCreateCheckbox("", 735, 455, 13, 13)
如上面这样就感觉有点不太人性化了


望各位老大抽点时间指点下

先谢为敬~!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2013-3-10 17:51:23 | 显示全部楼层
弄个内嵌的IE,用网页的形式实现
 楼主| 发表于 2013-3-10 19:03:42 | 显示全部楼层
回复 2# kevinch


    这样工程会不会更大 ?
发表于 2013-3-10 19:15:26 | 显示全部楼层
本帖最后由 afan 于 2013-3-10 22:14 编辑
Local $aiCkbox[16], $iLs = 4, $iSpacingX = 140, $iSpacingY = 80, $_Xbj = 140, $_Ybj = 70

GUICreate('', 600, 350)
For $i = 0 To UBound($aiCkbox) - 1
        $aiCkbox[$i] = GUICtrlCreateCheckbox('', $iSpacingX * Mod($i, $iLs) + $_Xbj, $iSpacingY * Floor($i / $iLs) + $_Ybj, 20, 20)
Next
GUISetState()
 
While GUIGetMsg() <> -3
WEnd
发表于 2013-3-10 19:16:59 | 显示全部楼层


#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("MustDeclareVars", 1)
Const $x0 = 15
Const $y0 = 10
Const $x_dis = 50
Const $y_dis = 50
Global $nMsg
Global $chkbox[4][5]
Local $i
Local $j
#Region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("Form1", 623, 449, 192, 114)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

For $i = 0 To UBound($chkbox, 1)-1
        For $j = 0 To UBound($chkbox, 2)-1
                $chkbox[$i][$j] = GUICtrlCreateCheckbox("", $x0+$j*$y_dis, $y0+$i*$x_dis, 13, 13)
        Next
Next

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2013-3-10 22:12:39 | 显示全部楼层
回复 4# afan


    谢谢版主可以亲自回复
 楼主| 发表于 2013-3-10 22:12:57 | 显示全部楼层
回复 5# veket_linux


    谢谢veket_linux姐姐
发表于 2013-3-10 22:14:50 | 显示全部楼层
回复 6# 872777825


    之前的多了一行…
 楼主| 发表于 2013-3-10 22:41:42 | 显示全部楼层
回复 8# afan


    嗯  看到了  那个修改一下  简单
不过现在又不知道怎么做全选以及全不选了 -_-
发表于 2013-3-10 23:05:42 | 显示全部楼层
回复 9# 872777825
Local $aiCkbox[16], $iLs = 4, $iSpacingX = 140, $iSpacingY = 80, $_Xbj = 140, $_Ybj = 70

GUICreate('测试', 600, 350)
$iBt0 = GUICtrlCreateButton('全选', 150, 20, 80, 22)
$iBt1 = GUICtrlCreateButton('反选', 240, 20, 80, 22)
$iBt2 = GUICtrlCreateButton('全否', 330, 20, 80, 22)
For $i = 0 To UBound($aiCkbox) - 1
        $aiCkbox[$i] = GUICtrlCreateCheckbox('', $iSpacingX * Mod($i, $iLs) + $_Xbj, $iSpacingY * Floor($i / $iLs) + $_Ybj, 20, 20)
Next
GUISetState()

While 1
        $msg = GUIGetMsg()
        Switch $msg
                Case -3
                        Exit
                Case $iBt0, $iBt2
                        For $i = 0 To UBound($aiCkbox) - 1
                                GuiCtrlSetState($aiCkbox[$i], ($msg - $iBt0 <> 0) * 3 + 1)
                        Next
                Case $iBt1
                        For $i = 0 To UBound($aiCkbox) - 1
                                GuiCtrlSetState($aiCkbox[$i], (GuiCtrlRead($aiCkbox[$i]) = 1) * 3 + 1)
                        Next
        EndSwitch
WEnd
 楼主| 发表于 2013-3-10 23:32:04 | 显示全部楼层
回复 10# afan


    再次感谢afan版主老大
发表于 2013-3-12 11:41:39 | 显示全部楼层
呵呵。。。A版再现,问题不见
发表于 2013-3-12 20:28:50 | 显示全部楼层
回复 12# xyhqqaa
“A版再现,问题不见”,呵呵,这话经典啊!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-7 11:41 , Processed in 0.083471 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表