找回密码
 加入
搜索
查看: 2772|回复: 1

[效率算法] 如何随机把64个控件都随机写入 ABCD,希望代码简洁点(已解决)

[复制链接]
发表于 2013-6-9 00:15:00 | 显示全部楼层 |阅读模式
本帖最后由 9922250 于 2013-6-9 00:21 编辑

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=d:\my documents\form1.kxf
$Form1_1 = GUICreate("小鸭子", 293, 396, 232, 142)
$Group1 = GUICtrlCreateGroup("Group1", 8, 8, 273, 337)
$Button1 = GUICtrlCreateButton("", 16, 32, 33, 33)
$Button2 = GUICtrlCreateButton("", 48, 32, 33, 33)
$Button3 = GUICtrlCreateButton("", 80, 32, 33, 33)
$Button4 = GUICtrlCreateButton("", 112, 32, 33, 33)
$Button5 = GUICtrlCreateButton("", 144, 32, 33, 33)
$Button6 = GUICtrlCreateButton("", 176, 32, 33, 33)
$Button7 = GUICtrlCreateButton("", 208, 32, 33, 33)
$Button8 = GUICtrlCreateButton("", 240, 32, 33, 33)
$Button9 = GUICtrlCreateButton("", 112, 64, 33, 33)
$Button10 = GUICtrlCreateButton("", 16, 64, 33, 33)
$Button11 = GUICtrlCreateButton("", 48, 64, 33, 33)
$Button12 = GUICtrlCreateButton("", 80, 64, 33, 33)
$Button13 = GUICtrlCreateButton("", 144, 64, 33, 33)
$Button14 = GUICtrlCreateButton("", 176, 64, 33, 33)
$Button15 = GUICtrlCreateButton("", 208, 64, 33, 33)
$Button16 = GUICtrlCreateButton("", 240, 64, 33, 33)
$Button17 = GUICtrlCreateButton("", 16, 96, 33, 33)
$Button18 = GUICtrlCreateButton("", 48, 96, 33, 33)
$Button19 = GUICtrlCreateButton("", 80, 96, 33, 33)
$Button20 = GUICtrlCreateButton("", 112, 96, 33, 33)
$Button21 = GUICtrlCreateButton("", 144, 96, 33, 33)
$Button22 = GUICtrlCreateButton("", 176, 96, 33, 33)
$Button23 = GUICtrlCreateButton("", 208, 96, 33, 33)
$Button24 = GUICtrlCreateButton("", 240, 96, 33, 33)
$Button25 = GUICtrlCreateButton("", 16, 128, 33, 33)
$Button26 = GUICtrlCreateButton("", 48, 128, 33, 33)
$Button27 = GUICtrlCreateButton("", 80, 128, 33, 33)
$Button28 = GUICtrlCreateButton("", 112, 128, 33, 33)
$Button29 = GUICtrlCreateButton("", 144, 128, 33, 33)
$Button30 = GUICtrlCreateButton("", 176, 128, 33, 33)
$Button31 = GUICtrlCreateButton("", 208, 128, 33, 33)
$Button32 = GUICtrlCreateButton("", 240, 128, 33, 33)
$Button33 = GUICtrlCreateButton("", 16, 160, 33, 33)
$Button34 = GUICtrlCreateButton("", 48, 160, 33, 33)
$Button35 = GUICtrlCreateButton("", 80, 160, 33, 33)
$Button36 = GUICtrlCreateButton("", 112, 160, 33, 33)
$Button37 = GUICtrlCreateButton("", 144, 160, 33, 33)
$Button38 = GUICtrlCreateButton("", 176, 160, 33, 33)
$Button39 = GUICtrlCreateButton("", 208, 160, 33, 33)
$Button40 = GUICtrlCreateButton("", 240, 160, 33, 33)
$Button41 = GUICtrlCreateButton("", 16, 192, 33, 33)
$Button42 = GUICtrlCreateButton("", 48, 192, 33, 33)
$Button43 = GUICtrlCreateButton("", 80, 192, 33, 33)
$Button44 = GUICtrlCreateButton("", 112, 192, 33, 33)
$Button45 = GUICtrlCreateButton("", 144, 192, 33, 33)
$Button46 = GUICtrlCreateButton("", 176, 192, 33, 33)
$Button47 = GUICtrlCreateButton("", 208, 192, 33, 33)
$Button48 = GUICtrlCreateButton("", 240, 192, 33, 33)
$Button49 = GUICtrlCreateButton("", 16, 224, 33, 33)
$Button50 = GUICtrlCreateButton("", 48, 224, 33, 33)
$Button51 = GUICtrlCreateButton("", 80, 224, 33, 33)
$Button52 = GUICtrlCreateButton("", 112, 224, 33, 33)
$Button53 = GUICtrlCreateButton("", 144, 224, 33, 33)
$Button54 = GUICtrlCreateButton("", 176, 224, 33, 33)
$Button55 = GUICtrlCreateButton("", 208, 224, 33, 33)
$Button56 = GUICtrlCreateButton("", 240, 224, 33, 33)
$Button57 = GUICtrlCreateButton("", 16, 256, 33, 33)
$Button58 = GUICtrlCreateButton("", 48, 256, 33, 33)
$Button59 = GUICtrlCreateButton("", 80, 256, 33, 33)
$Button60 = GUICtrlCreateButton("", 112, 256, 33, 33)
$Button61 = GUICtrlCreateButton("", 144, 256, 33, 33)
$Button62 = GUICtrlCreateButton("", 176, 256, 33, 33)
$Button63 = GUICtrlCreateButton("", 208, 256, 33, 33)
$Button64 = GUICtrlCreateButton("", 240, 256, 33, 33)
$Button65 = GUICtrlCreateButton("开始", 32, 304, 57, 33)
$Button67 = GUICtrlCreateButton("重试", 120, 304, 57, 33)
$Button66 = GUICtrlCreateButton("退出", 208, 304, 57, 33)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

                Case $Button65
                       
                        For $i = 1 To 64 Step 1
                                $g_iChar_Curr = Random(65, 68, 1)
                                ControlSetText ( "小鸭子", "", $Button1, Chr($g_iChar_Curr))
                        Next

                Case $Button66
                        Exit
        EndSwitch
WEnd
 楼主| 发表于 2013-6-9 00:21:33 | 显示全部楼层
eval('button' & $i)           看帮助,搞定了。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-11-17 17:31 , Processed in 0.075052 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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