本帖最后由 benkel 于 2012-2-27 01:54 编辑
那个不是对齐!菜单左边的空间是给图标、复选标记预留出的空间,_GUICtrlMenu_SetMenuStyle来让菜单不预留,例子:#include <GuiMenu.au3>
Local $MenuItem[6]
Local $MenuItemName[6] = ['打开', '新建 &N', '打开 &O', '保存 &S', '', '退出 &X']
$hGUI = GUICreate("菜单函数演示", 400, 300)
; 创建文件菜单
$hMenu = GUICtrlCreateMenu("菜单")
For $i = 0 To UBound($MenuItem) - 1
$MenuItem[$i] = GUICtrlCreateMenuItem($MenuItemName[$i], $hMenu)
Next
$hMain = _GUICtrlMenu_GetMenu($hGUI)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)
ConsoleWrite(_GUICtrlMenu_SetMenuStyle($hFile,$MNS_NOCHECK) & @CRLF)
GUISetState()
Do
Until GUIGetMsg() = -3
补充:
$hMain = _GUICtrlMenu_GetMenu($hGUI)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)
可以用$hFile = GUICtrlGetHandle($hMenu)来代替 |