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

[GUI管理] GUICtrlCreateMenu求助

[复制链接]
发表于 2013-4-26 14:20:41 | 显示全部楼层 |阅读模式
GUICtrlCreateMenu怎么在右侧建立?
都默认建立在最左边了
发表于 2013-4-27 12:07:10 | 显示全部楼层
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $defaultstatus = "已就緒", $status, $filemenu, $fileitem
    Local $helpmenu, $saveitem, $infoitem, $exititem, $recentfilesmenu
    Local $separator1, $viewmenu, $viewstatusitem, $okbutton, $cancelbutton
    Local $statuslabel, $msg, $file
    
    GUICreate("我的 GUI 選單", 300, 200)


    $filemenu = GUICtrlCreateMenu("檔案(&F)")
    $fileitem = GUICtrlCreateMenuItem("開啟", $filemenu)
    GUICtrlSetState(-1, $GUI_DEFBUTTON)
    $helpmenu = GUICtrlCreateMenu("?")
    $saveitem = GUICtrlCreateMenuItem("儲存", $filemenu)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $infoitem = GUICtrlCreateMenuItem("資訊", $helpmenu)
    $exititem = GUICtrlCreateMenuItem("結束", $filemenu)
    $recentfilesmenu = GUICtrlCreateMenu("最近存取過的檔案", $filemenu, 1)

    $separator1 = GUICtrlCreateMenuItem("", $filemenu, 2)   ; 建立分隔線

    $viewmenu = GUICtrlCreateMenu("檢視", -1, 1)    ; 建立於 "?" 選單前
    $viewstatusitem = GUICtrlCreateMenuItem("狀態列", $viewmenu)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $okbutton = GUICtrlCreateButton("確定", 50, 130, 70, 20)
    GUICtrlSetState(-1, $GUI_FOCUS)
    $cancelbutton = GUICtrlCreateButton("取消", 180, 130, 70, 20)

    $statuslabel = GUICtrlCreateLabel($defaultstatus, 0, 165, 300, 16, BitOR($SS_SIMPLE, $SS_SUNKEN))

    GUISetState()
    While 1
        $msg = GUIGetMsg()
        
        If $msg = $fileitem Then
            $file = FileOpenDialog("選擇檔案...", @TempDir, "全部檔案 (*.*)")
            If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu)
        EndIf
        If $msg = $viewstatusitem Then
            If BitAND(GUICtrlRead($viewstatusitem), $GUI_CHECKED) = $GUI_CHECKED Then
                GUICtrlSetState($viewstatusitem, $GUI_UNCHECKED)
                GUICtrlSetState($statuslabel, $GUI_HIDE)
            Else
                GUICtrlSetState($viewstatusitem, $GUI_CHECKED)
                GUICtrlSetState($statuslabel, $GUI_SHOW)
            EndIf
        EndIf
        If $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton Or $msg = $exititem Then ExitLoop
        If $msg = $infoitem Then MsgBox(0, "資訊", "只是一個測試...")
    WEnd
    GUIDelete()
EndFunc   ;==>Example
 楼主| 发表于 2013-4-27 20:43:37 | 显示全部楼层
本帖最后由 lin6051 于 2013-4-27 20:45 编辑

回复 2# txen548


我意思是建1个菜单就在最右侧,
算了,不纠结了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-5 06:55 , Processed in 0.069435 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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