oo2010 发表于 2011-10-16 09:51:00

有没有鼠标移动到按钮上面触发的事件[已解决]

本帖最后由 oo2010 于 2011-10-16 13:02 编辑

可不可以当鼠标移动到按钮上面,就触发事件,当离开按钮时也能触发事件,现实操作中每一次都需要去点击按钮太麻烦了,类似网页上面的mouseon函数的功能

tryhi 发表于 2011-10-16 12:13:39

本帖最后由 tryhi 于 2011-10-16 12:15 编辑

$Form1 = GUICreate("Form1", 432, 292, 610, 254)
$Button1 = GUICtrlCreateButton("Button1", 125, 100, 182, 65)
GUISetState(@SW_SHOW)
While 1
        $Info = GUIGetCursorInfo()
        If @error Then
                ToolTip('窗口没激活')
        ElseIf $Info = $Button1 Then
               ToolTip('鼠标停在按钮上')
        Else
                ToolTip('鼠标没停在按钮上')
        EndIf
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case -3
                        Exit
        EndSwitch
WEnd

chenronting 发表于 2011-10-16 17:55:42

回复 2# tryhi


    很好,学习了,谢谢!

llllllxllllll 发表于 2014-8-19 13:30:57

离开按钮后事件一直在触发,能做到触发一次就好了
页: [1]
查看完整版本: 有没有鼠标移动到按钮上面触发的事件[已解决]