gaozhenghong 发表于 2009-12-23 17:41:42

autoit中有没有鼠标经过事件?高手请进

autoit中有没有鼠标经过事件?做好一个界面,上面有几个按钮,当鼠标经过某一个按钮时显示相应信息。

afan 发表于 2009-12-23 17:43:47

GUICtrlSetTip()

gaozhenghong 发表于 2009-12-23 17:55:16

这个只能在鼠标位置显示。我要的是当鼠标经过按钮时,text中显示相应的信息

顽固不化 发表于 2009-12-23 18:39:03

GUIGetCursorInfo
--------------------------------------------------------------------------------

获取(相对于 GUI 窗口的)鼠标位置.


GUIGetCursorInfo ( [窗口句柄] )




参数

窗口句柄 [可选参数] 目标窗口句柄。若此参数缺省则使用"当前"窗口.



返回值

成功: 返回一个5个元素的数组来表示鼠标的坐标信息:
$array = X 坐标 (水平轴)
$array = Y 坐标(垂直轴)
$array = 鼠标左键被按下 (1 为按下, 0 为未按下)
$array = 鼠标右键被按下 (1 未按下, 0 为未按下)
$array = 鼠标下面的控件的控件ID( 0 为没有或者无法获取)
失败: 返回 0 并设置 @error 为 1

gaozhenghong 发表于 2009-12-23 19:14:08

不太明白,烦请楼上的赐教!!!

顽固不化 发表于 2009-12-23 20:17:08

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 440, 240, -1, -1)
$Button1 = GUICtrlCreateButton("确定", 336, 16, 97, 33)
$Button2 = GUICtrlCreateButton("退出", 336, 64, 97, 33)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 313, 193)
GUICtrlSetData(-1, "文本框")
$Group1 = GUICtrlCreateGroup("", 0, 208, 440, 10)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label1 = GUICtrlCreateLabel("", 8, 218, 430, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $mouseinfo=GUIGetCursorInfo()
        Switch $mouseinfo
                Case $Button1
                        If GUICtrlRead($Label1)<>"鼠标在<确定>上" Then        GUICtrlSetData($Label1,"鼠标在<确定>上")
                Case $Button2
                        If GUICtrlRead($Label1)<>"鼠标在<退出>上" Then        GUICtrlSetData($Label1,"鼠标在<退出>上")
                Case $Edit1
                        If GUICtrlRead($Label1)<>"鼠标在<文本框>上" Then        GUICtrlSetData($Label1,"鼠标在<文本框>上")
                Case Else
                        GUICtrlSetData($Label1,"")
        EndSwitch       
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE,$Button2
                        Exit

        EndSwitch
WEnd

131738 发表于 2009-12-23 20:17:33

$Txet = GUICtrlRead ( GUIGetCursorInfo ( [窗口句柄] ) )
$text = 返回鼠标停留某按钮的文本

xlcwxl 发表于 2009-12-24 09:09:21

6楼正解

也是我需要的,楼主结贴吧
页: [1]
查看完整版本: autoit中有没有鼠标经过事件?高手请进