找回密码
 加入
搜索
查看: 2255|回复: 7

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

  [复制链接]
发表于 2009-12-23 17:41:42 | 显示全部楼层 |阅读模式
autoit中有没有鼠标经过事件?做好一个界面,上面有几个按钮,当鼠标经过某一个按钮时显示相应信息。
发表于 2009-12-23 17:43:47 | 显示全部楼层
GUICtrlSetTip()
 楼主| 发表于 2009-12-23 17:55:16 | 显示全部楼层
这个只能在鼠标位置显示。我要的是当鼠标经过按钮时,text中显示相应的信息
发表于 2009-12-23 18:39:03 | 显示全部楼层
GUIGetCursorInfo
--------------------------------------------------------------------------------

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


GUIGetCursorInfo ( [窗口句柄] )




参数

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



返回值

成功: 返回一个5个元素的数组来表示鼠标的坐标信息:  
$array[0] = X 坐标 (水平轴)
$array[1] = Y 坐标(垂直轴)
$array[2] = 鼠标左键被按下 (1 为按下, 0 为未按下)
$array[3] = 鼠标右键被按下 (1 未按下, 0 为未按下)  
$array[4] = 鼠标下面的控件的控件ID( 0 为没有或者无法获取)  
失败: 返回 0 并设置 @error 为 1
 楼主| 发表于 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[4]
                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

评分

参与人数 2金钱 +50 收起 理由
wenjeon + 30
afan + 20

查看全部评分

发表于 2009-12-23 20:17:33 | 显示全部楼层
$Txet = GUICtrlRead ( GUIGetCursorInfo ( [窗口句柄] )[4] )
$text = 返回鼠标停留某按钮的文本
发表于 2009-12-24 09:09:21 | 显示全部楼层
6楼正解

也是我需要的,楼主结贴吧
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-22 15:50 , Processed in 0.082756 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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