找回密码
 加入
搜索
查看: 1662|回复: 3

请高手帮改下源码

[复制链接]
发表于 2009-3-2 16:18:40 | 显示全部楼层 |阅读模式
请高手帮改下源码
这是我写的工具栏菜单,请高手给我把重复的创建控件部分和响应部分改成循环以精减代码
高手能帮我改成Event模式就更好了
这是我的工具条界面,实现自动隐藏

[ 本帖最后由 jsnewbee 于 2009-3-3 09:52 编辑 ]

本帖子中包含更多资源

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

×
发表于 2009-3-3 00:47:28 | 显示全部楼层
#include <WindowsConstants.au3>
#include <StaticConstants.au3>

Global $Total, $Bu = 500, $Apex = 0
Dim $Button[$Bu]

$Total = IniReadSection("_conf.ini", "LINK")

$Form1 = GUICreate("主窗体", 1000, 35, 20, 5, BitOR _
     ($WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS))
$Pic1 = GUICtrlCreatePic("bg_hm.jpg", 0, 0, 1000, 35, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

GUISetState()

For $i = 1 To $Total[0][0]
  $Button[$i] = GUICtrlCreateButton($Total[$i][0], $Apex+55*$i, 2, 50, 30)
Next

While 1
    Sleep(1000)
WEnd
;暂时用按钮代替!坐标你再调整!
发表于 2009-3-3 03:22:40 | 显示全部楼层
优化了一下楼上的代码

#include <WindowsConstants.au3>
#include <StaticConstants.au3>
Opt("GUIOnEventMode", 1)

Global $Total, $Bu = 500, $Apex = 0
Dim $Button[$Bu][2]

$Form1 = GUICreate("主窗体", 1000, 35, 20, 5, BitOR _
                ($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_POPUP, $WS_GROUP, $WS_CLIPSIBLINGS))
;~ $Pic1 = GUICtrlCreatePic("bg_hm.jpg", 0, 0, 1000, 35, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))

GUISetState()

$Total = IniReadSection("_conf.ini", "LINK")

For $i = 1 To $Total[0][0]
        $Button[$i][0] = GUICtrlCreateButton($Total[$i][0], $Apex+55*$i, 2, 50, 30)
        $Button[$i][1] = $Total[$i][1]
        GUICtrlSetOnEvent($Button[$i][0], "B_Msg")
Next

While 1
        Sleep(1000)
WEnd

Func B_Msg()
        MsgBox(0, 0, 0)
        For $i = 1 To UBound($Button, 1) - 1
                If @GUI_CtrlId = $Button[$i][0] Then Run($Button[$i][1])
        Next
EndFunc   ;==>B_Msg
 楼主| 发表于 2009-3-3 09:52:43 | 显示全部楼层
谢谢了,感谢楼上两位
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-19 00:34 , Processed in 0.076065 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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