还不会看帮助文件?????
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <StaticConstants.au3>
Example()
Func Example()
Local $sDefaultstatus = "准备就绪"
GUICreate("菜单控件 GUI", 300, 200)
Local $idFilemenu = GUICtrlCreateMenu("文件 &F")
Local $idFileitem = GUICtrlCreateMenuItem("打开", $idFilemenu)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
Local $idHelpmenu = GUICtrlCreateMenu("?")
GUICtrlCreateMenuItem("保存", $idFilemenu)
GUICtrlSetState(-1, $GUI_DISABLE)
Local $idInfoitem = GUICtrlCreateMenuItem("信息", $idHelpmenu)
Local $idExititem = GUICtrlCreateMenuItem("退出", $idFilemenu)
Local $idRecentfilesmenu = GUICtrlCreateMenu("最近的文件", $idFilemenu, 1)
GUICtrlCreateMenuItem("", $idFilemenu, 2) ; 创建分隔线
Local $idViewmenu = GUICtrlCreateMenu("查看", -1, 1) ; 创建在 "?" 之前的菜单
Local $idViewstatusitem = GUICtrlCreateMenuItem("状态栏", $idViewmenu)
GUICtrlSetState(-1, $GUI_CHECKED)
$menu6 = GUICtrlCreateMenu("帮助[&H]")
$MenuItem22 = GUICtrlCreateMenuItem("关于[&G]", $menu6)
GUICtrlCreateButton("确定", 50, 130, 70, 20)
GUICtrlSetState(-1, $GUI_FOCUS)
Local $idCancelbutton = GUICtrlCreateButton("取消", 180, 130, 70, 20)
Local $idStatuslabel = GUICtrlCreateLabel($sDefaultstatus, 0, 165, 300, 16, BitOR($SS_SIMPLE, $SS_SUNKEN))
GUISetState(@SW_SHOW)
Local $sFile
; 循环到用户退出.
While 1
Switch GUIGetMsg()
Case $idFileitem
$sFile = FileOpenDialog("选择文件...", @TempDir, "所有文件 (*.*)")
If @error <> 1 Then GUICtrlCreateMenuItem($sFile, $idRecentfilesmenu)
Case $idViewstatusitem
If BitAND(GUICtrlRead($idViewstatusitem), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($idViewstatusitem, $GUI_UNCHECKED)
GUICtrlSetState($idStatuslabel, $GUI_HIDE)
Else
GUICtrlSetState($idViewstatusitem, $GUI_CHECKED)
GUICtrlSetState($idStatuslabel, $GUI_SHOW)
EndIf
Case $GUI_EVENT_CLOSE, $idCancelbutton, $idExititem
ExitLoop
Case $idInfoitem
MsgBox($MB_SYSTEMMODAL, "信息", "只是一个测试...")
Case $MenuItem22
MsgBox($MB_SYSTEMMODAL, "回答", "弹出来一个 msgbox 消息框...")
EndSwitch
WEnd
GUIDelete()
EndFunc ;==>Example
|