|
发表于 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 |
评分
-
查看全部评分
|