找回密码
 加入
搜索
查看: 1847|回复: 0

[AU3基础] 請問如何改變按過的 按鈕的顏色 [已解決]

[复制链接]
发表于 2010-8-31 22:58:39 | 显示全部楼层 |阅读模式
本帖最后由 amadisyeh 于 2010-8-31 23:19 编辑

請問如何改變按過的 按鈕的顏色

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $Button_1, $Button_2, $msg
    GUICreate("My GUI Button") ; will create a dialog box that when displayed is centered

    Opt("GUICoordMode", 2)
    $Button_1 = GUICtrlCreateButton("Run Notepad", 10, 30, 100)
    $Button_2 = GUICtrlCreateButton("Button Test", 0, -1)
;GUICtrlSetColor(-1,0x0200FB)  

    GUISetState()      ; will display an  dialog box with 2 button

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
        $Button_1 =GUICtrlSetColor(-1,0x0200FB)  
        Run('Notepad.exe')    ; Will Run/Open Notepad
            Case $msg = $Button_2
        GUICtrlSetColor(-1, 0xcccccc)   
                MsgBox(0, 'Testing', 'Button 2 was pressed')    ; Will demonstrate Button 2 being pressed
        EndSelect
    WEnd
EndFunc   ;==>Example

  我總是只能改變  Button_2 的顏色
------------------------------------------------------------------------------
先用 Au3Info.exe 把 button 的 controlID 找出來並且填上就可以了

评分

参与人数 1金钱 +10 收起 理由
afan + 10 感谢主动将修改帖子分类为[已解决],请继续 ...

查看全部评分

您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-10-3 08:16 , Processed in 0.082274 second(s), 28 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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