本帖最后由 yhxhappy 于 2011-3-6 17:22 编辑
楼主的贴的代码语法高亮是什么做的?#NoTrayIcon
#include <Constants.au3>
#include <GUIConstantsEx.au3>
Opt("TrayMenuMode",1) ; 不显示默认菜单(脚本暂停/退出).
Opt("GUIOnEventMode", 1) ;事件模式
Global $ConfigGUI, $ok1, $ok2
$ConfigProgram = TrayCreateItem("配置", -1, 0, 1)
$AboutProgram = TrayCreateItem("关于", -1, 2, 1)
$ExitProgram = TrayCreateItem("退出", -1, 3, 1)
TraySetClick(16)
TraySetState()
While 1
$msg = TrayGetMsg()
Switch $msg
Case $ConfigProgram
ConfigGUI()
Case $AboutProgram
AboutProgram()
Case $ExitProgram
Exit
Case $TRAY_EVENT_PRIMARYDOWN
ConfigGUI()
AboutProgram()
EndSwitch
WEnd
Func ConfigGUI($a = 0)
$ConfigGUI = GUICreate("Config")
GUISetOnEvent($GUI_EVENT_CLOSE, "_GUI")
$ok1 = GUICtrlCreateButton("Hi:", 10, 10, 30, 20)
GUICtrlSetOnEvent(-1, "_GUI")
GUISetState()
EndFunc
Func AboutProgram()
$Pos = WinGetPos($ConfigGUI)
If $Pos = 0 Then
$x = Default
$y = Default
Else
$x = $Pos[0]+$Pos[2]+10
$y = $Pos[1]
EndIf
GUICreate("About", -1, -1, $x, $y)
GUISetOnEvent($GUI_EVENT_CLOSE, "_GUI")
$About = GUICtrlCreateLabel("This is About", 10, 10, 100, 20)
$ok2 = GUICtrlCreateButton("Ok", 10, 50, 30, 20)
GUICtrlSetOnEvent(-1, "_GUI")
GUISetState()
EndFunc
Func _GUI()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE, $ok1, $ok2
GUIDelete(@GUI_WinHandle)
EndSwitch
EndFunc
|