找回密码
 加入
搜索
查看: 3388|回复: 9

[GUI管理] 【已解决】按钮背景色问题

  [复制链接]
发表于 2014-3-19 22:22:25 | 显示全部楼层 |阅读模式
本帖最后由 wlb 于 2014-3-23 10:39 编辑

有一个按钮
$Button = GUICtrlCreateButton("#1", 280, 264, 30, 25)
GUICtrlSetState(-1,$GUI_DISABLE)

在一定条件下执行
GUICtrlSetBkColor($Button, 0x00ff00)
改变了按钮的背景色

若需要再在另一条件下将其变回成没有背景色的情况,该如何操作?
发表于 2014-3-20 07:40:18 | 显示全部楼层
#include <GUIConstants.au3>
$Form1 = GUICreate("", 400, 100,-1,-1)
$Button = GUICtrlCreateButton("", 10, 50, 75, 22, 0)
GUICtrlSetBkColor(-1, 0x00ff00)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
        $nMsg = GUIGetMsg()
        Select
               Case $nMsg = $GUI_EVENT_CLOSE
                    Exit
        Case $nMsg = $Button
           GUICtrlSetBkColor($Button, 0xff0000)
           MsgBox(0,"","颜色已改变")
            Sleep(250)
           GUICtrlSetBkColor($Button, 0x00ff00)
       EndSelect
WEnd
 楼主| 发表于 2014-3-20 17:56:56 | 显示全部楼层
我是想实现变回初始状态(无色)
发表于 2014-3-20 18:37:23 | 显示全部楼层
改回样式
 楼主| 发表于 2014-3-21 17:55:35 | 显示全部楼层
请问怎么改回样式呢?主要用哪个函数
回复 4# afan
发表于 2014-3-21 18:28:01 | 显示全部楼层
GUICtrlSetStyle()
 楼主| 发表于 2014-3-21 20:53:25 | 显示全部楼层
可以了,非常感谢!!!
回复 6# afan
 楼主| 发表于 2014-3-23 10:38:46 | 显示全部楼层
很不错啊不错
发表于 2015-3-22 05:08:42 | 显示全部楼层
谢谢分享 收藏
发表于 2015-4-13 06:24:39 | 显示全部楼层
很不错的问题刚好解决我的烦恼
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-19 01:57 , Processed in 0.088058 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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