找回密码
 加入
搜索
查看: 2656|回复: 13

关于鼠标经过时提示!

[复制链接]
发表于 2008-6-11 01:21:24 | 显示全部楼层 |阅读模式
如图所示:



本人想实现每当鼠标经过或停留在按键时会在右侧显示每一个按键的用途或说明

请各位高手指教和试例一下!谢谢~!

[ 本帖最后由 kv998 于 2008-6-12 19:24 编辑 ]
发表于 2008-6-11 03:37:04 | 显示全部楼层
官网UDF,楼上的兄弟你试试.


[ 本帖最后由 bing614 于 2008-6-11 03:45 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2008-6-11 03:48:24 | 显示全部楼层
也可以这样:
[au3]#include <GUIConstantsEx.au3>
$Form1 = GUICreate("Form1", 344, 197, 322, 179)
$Edit1 = GUICtrlCreateEdit("", 120, 24, 209, 137)
$Button1 = GUICtrlCreateButton("Button1", 16, 24, 75, 25, 0)
$Button2 = GUICtrlCreateButton("Button2", 16, 80, 75, 25, 0)
$Button3 = GUICtrlCreateButton("Button3", 16, 128, 75, 25, 0)
GUICtrlSetData(-1, "Edit1")
GUISetState(@SW_SHOW)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit               
        EndSwitch
        $mouse=GUIGetCursorInfo()
        Switch $mouse[4]
                Case $Button1
                        GUICtrlSetData($Edit1, "我的 Button1 控件.")
                Case $Button2
                        GUICtrlSetData($Edit1, "我的 Button2 控件.")
                Case $Button3
                        GUICtrlSetData($Edit1, "我的 Button3 控件.")       
        EndSwitch
WEnd[/au3]
发表于 2008-6-11 07:52:50 | 显示全部楼层
同意三楼
但是这样做 好像会造成Label的不断刷新
#include <GUIConstantsEx.au3>
$Form = GUICreate("Form1", 344, 197, 322, 179)
$Label = GUICtrlCreateLabel("", 120, 24, 209, 137)
$Button1 = GUICtrlCreateButton("Button1", 16, 24, 75, 25, 0)
$Button2 = GUICtrlCreateButton("Button2", 16, 80, 75, 25, 0)
$Button3 = GUICtrlCreateButton("Button3", 16, 128, 75, 25, 0)
GUISetState(@SW_SHOW)
Dim $Last
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit        
    EndSwitch
    $mouse=GUIGetCursorInfo()
        If $Last <> $mouse[4] Then
                Switch $mouse[4]
                        Case $Button1
                                GUICtrlSetData($Label, "我的 Button1 控件.")
                        Case $Button2
                                GUICtrlSetData($Label, "我的 Button2 控件.")
                        Case $Button3
                                GUICtrlSetData($Label, "我的 Button3 控件.")   
                EndSwitch
        $Last = $mouse[4]
        EndIf
WEnd

这样就能解决不断闪烁的问题了
发表于 2008-6-11 07:55:22 | 显示全部楼层
判断思路是
如果现在的 控件 不是上一个控件 才进行变换操作
这个也比较适合 使用者的意图
如果还要做 当不在控件上时 清空说明的操作
在case 的情况中加入
   
                        Case 0
                                GUICtrlSetData($Label, "")   
就行了
 楼主| 发表于 2008-6-11 13:12:45 | 显示全部楼层

感谢各位的兄弟的帮助
我觉得这个论坛的网友都好热情、热心,昨晚发的帖那么快就有人回应了
谢谢~!
祝贵坛越办越好、红红火火~!
 楼主| 发表于 2008-6-11 13:18:42 | 显示全部楼层
思路好!
 楼主| 发表于 2008-6-12 09:20:04 | 显示全部楼层

鼠标点其他东西时会弹出错误

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2008-6-12 10:20:40 | 显示全部楼层
出错原因在
$mouse=GUIGetCursorInfo()
应该为 打漏了
$mouse=GUIGetCursorInfo($Form)
 楼主| 发表于 2008-6-12 10:43:26 | 显示全部楼层
感谢~!
发表于 2009-4-25 14:17:25 | 显示全部楼层
ToolTip ( "文本" [, X坐标 [, Y坐标 [, "标题" [, 图标 [, 选项]]]]] )

详见帮助
发表于 2009-4-25 16:52:38 | 显示全部楼层
同意三楼
但是这样做 好像会造成Label的不断刷新
#include
$Form = GUICreate("Form1", 344, 197, 322, 179)
$Label = GUICtrlCreateLabel("", 120, 24, 209, 137)
$Button1 = GUICtrlCreateButton("Button1", ...
zhang0121 发表于 2008-6-11 07:52

我在GHI上面测试了下,对于经过一个按钮时,修改图片控件会出错,闪不会闪,但是对应的图片不对,当一时有可能为二也有可能为三,按钮一对应的是修改图片控件为图片1,二就为2,但是错乱的!
最后我解决方法是

Switch $mouse[4]
                                                                                Case $Button7
                                                                                                GUICtrlSetData($Pic1, GUICtrlCreatePic("html\"&$Button[9]&".jpg", 8, 442, 112, 86))
                                                                                                Sleep(1000)
                                                                                Case $Button8
                                                                                                GUICtrlSetData($Pic1, GUICtrlCreatePic("html\"&$Button[10]&".jpg", 8, 442, 112, 86))
                                                                                                Sleep(1000)
                                                                                Case $Button9
                                                                                                GUICtrlSetData($Pic1, GUICtrlCreatePic("html\"&$Button[11]&".jpg", 8, 442, 112, 86))
                                                                                                Sleep(1000)
                                                                EndSwitch

中间sleep加得有点过大!
发表于 2009-4-25 17:09:05 | 显示全部楼层
本帖最后由 jycel 于 2009-4-25 17:20 编辑

还有个问题!怎么只能是Switch $mouse[4]多添加的都无法,提示超过数组界限
在三个以后又加为
$mouse2=GUIGetCursorInfo($Form1)
                                                                Switch $mouse2[4]       
一直到$mouseN               
才解决!
发表于 2009-4-25 18:42:35 | 显示全部楼层
.........
GUICtrlSetTip
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-28 04:45 , Processed in 0.080610 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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