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

[AU3基础] 【已解决】鼠标移到控件上,改变它的颜色,应该用什么函数?

[复制链接]
发表于 2017-1-11 16:56:59 | 显示全部楼层 |阅读模式
本帖最后由 229989799 于 2017-1-19 13:16 编辑

鼠标移到控件上,改变它的颜色,应该用什么函数?


#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 381, 201, 192, 124)
$Label1 = GUICtrlCreateLabel("如何让鼠标移到此处,文本改变颜色呢", 40, 80, 280, 17)
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $Label1
                        Msgbox(0,"hello","hello")
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd
发表于 2017-1-11 18:45:51 | 显示全部楼层
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 381, 201, 192, 124)
$Label1 = GUICtrlCreateLabel("如何让鼠标移到此处,文本改变颜色呢", 40, 80, 280, 17)
GUICtrlSetColor($Label1, 0x0000ff)
GUICtrlSetCursor(-1, 0)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
AdlibRegister('_set_lb_color', 600)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $Label1
                        MsgBox(0, "hello", "hello")
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd

Func _set_lb_color()
        Local $aCur = GUIGetCursorInfo($Form1)
        If Not IsArray($aCur) Then Return
        If $aCur[4] == $Label1 Then
                GUICtrlSetColor($Label1, 0xff0000)
        Else
                GUICtrlSetColor($Label1, 0x0000ff)
        EndIf
EndFunc
 楼主| 发表于 2017-1-12 09:06:38 | 显示全部楼层
谢谢楼上兄弟。
发表于 2017-1-18 10:50:08 | 显示全部楼层
这个我也需要,标记一下
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-3-29 03:55 , Processed in 0.076473 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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