找回密码
 加入
搜索
查看: 2321|回复: 2

鼠标经过按钮提示的讨论

[复制链接]
发表于 2010-1-8 13:12:32 | 显示全部楼层 |阅读模式
怎么样能让鼠标经过某个按钮时出现这样的提示?

还有,可不可以让提示的文字在标题上显示呢?

本帖子中包含更多资源

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

×
发表于 2010-1-8 13:45:42 | 显示全部楼层
按钮上显示提示
tooltip()
发表于 2010-1-8 14:20:35 | 显示全部楼层
我比较喜欢用状态栏提示文字这种方式,下面是随手写的一个界面提示的例子,用tooltip有时候太麻烦,而且容易遮挡界面。。。


#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 228, 128, 192, 124)
$Button1 = GUICtrlCreateButton("1", 8, 8, 65, 25)
$Button2 = GUICtrlCreateButton("2", 80, 8, 65, 25)
$Button3 = GUICtrlCreateButton("3", 152, 8, 65, 25)
$Button4 = GUICtrlCreateButton("4", 8, 40, 65, 25)
$Button5 = GUICtrlCreateButton("5", 80, 40, 65, 25)
$Button6 = GUICtrlCreateButton("6", 152, 40, 65, 25)
$Button7 = GUICtrlCreateButton("7", 8, 72, 65, 25)
$Button8 = GUICtrlCreateButton("8", 80, 72, 65, 25)
$Button9 = GUICtrlCreateButton("9", 152, 72, 65, 25)
$Label1 = GUICtrlCreateLabel("状态栏", 8, 104, 140, 17)
GUICtrlSetColor(-1, 0x0000FF)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$Lastcontrol = 0
While 1
        $nMsg = GUIGetMsg()
        $mouse = GUIGetCursorInfo($Form1)
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
        EndSwitch
        Switch $mouse[4];鼠标移到指定控件显示提示文字,可增加很多
                Case $Button1
                        If $mouse[4] <> $Lastcontrol Then
                                GUICtrlSetData($Label1, "按钮1") ;给出工具提示
                                $Lastcontrol = $mouse[4];记录最后一次鼠标放置的控件
                        EndIf
                Case $Button2
                        If $mouse[4] <> $Lastcontrol Then;必须加这个验证一下上次鼠标放置的控件是不是当前控件,否则会一直更新提示文字
                                GUICtrlSetData($Label1, "按钮2")
                                $Lastcontrol = $mouse[4]
                        EndIf
                Case $Button3
                        If $mouse[4] <> $Lastcontrol Then
                                GUICtrlSetData($Label1, "按钮3")
                                $Lastcontrol = $mouse[4]
                        EndIf
                Case $Button4
                        If $mouse[4] <> $Lastcontrol Then
                                GUICtrlSetData($Label1, "按钮4") ;给出工具提示
                                $Lastcontrol = $mouse[4];记录最后一次鼠标放置的控件
                        EndIf
                Case $Button5
                        If $mouse[4] <> $Lastcontrol Then;必须加这个验证一下上次鼠标放置的控件是不是当前控件,否则会一直更新提示文字
                                GUICtrlSetData($Label1, "按钮5")
                                $Lastcontrol = $mouse[4]
                        EndIf
                Case $Button6
                        If $mouse[4] <> $Lastcontrol Then
                                GUICtrlSetData($Label1, "按钮6")
                                $Lastcontrol = $mouse[4]
                        EndIf                               
;~                 Case Else
;~                         If $mouse[4] <> $Lastcontrol Then
;~                                 GUICtrlSetData($Label1, "这里是状态栏提示文字。。。。。")
;~                                 $Lastcontrol = $mouse[4]
;~                         EndIf
        EndSwitch
WEnd

评分

参与人数 1金钱 +10 收起 理由
afan + 10

查看全部评分

您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-22 14:41 , Processed in 0.104047 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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