次の方法で共有


Menu Constants (Compact 2013)

3/28/2014

The following table shows the menu constants, with a description of the purpose of each.

Note that menu items cannot be disabled without being grayed. To disable a menu item, use the MF_GRAYED constant.

Programming element

Description

MF_BYCOMMAND

Identifies menu item position by command.

MF_BYCOMMAND is the default if neither the MF_BYCOMMAND nor MF_BYPOSITION constant is specified.

MF_BYCOMMAND cannot be used with the MF_BYPOSITION constant.

MF_BYPOSITION

Identifies menu item position by zero-based relative position.

MF_BYPOSITION cannot be used with the MF_BYCOMMAND constant.

MF_CHECKED

Places a check mark next to the menu item.

MF_CHECKED cannot be used with the MF_UNCHECKED constant.

MF_ENABLED

Enables the menu item so that it can be selected and restores it from its grayed state.

MF_ENABLED cannot be used with the MF_GRAYED constant.

MF_GRAYED

Disables the menu item and grays it out so that it cannot be selected.

MF_GRAYED cannot be used with the MF_ENABLED constant.

MF_HILITE

Highlights the menu item.

MF_HILITE cannot be used with the MF_UNHILITE constant.

MF_MENUBARBREAK

Functions the same as the MF_MENUBREAK flag for a menu bar. For a drop-down menu, submenu, or shortcut menu, the new column is separated from the old column by a vertical line.

MF_MENUBARBREAK cannot be used with the MF_MENUBREAK constant.

MF_MENUBREAK

Places the item on a new line (for menu bars) or in a new column (for a drop-down menu, submenu, or shortcut menu) without separating columns.

MF_MENUBREAK cannot be used with the MF_MENUBARBREAK constant.

MF_OWNERDRAW

Specifies that the item is an owner-drawn item. The value for this constant is in the itemData member of the structure pointed to by the lparam parameter of the WM_MEASUREITEM or WM_DRAWITEM message sent when the menu item is created or its appearance is updated.

Before the menu is displayed for the first time, the window that owns the menu receives a WM_MEASUREITEM message to retrieve the width and height of the menu item. The WM_DRAWITEM message is then sent to the window procedure of the owner window when the appearance of the menu item must be updated.

MF_OWNERDRAW cannot be used with MF_STRING or MF_SEPARATOR.

MF_POPUP

Specifies that the menu item opens a drop-down menu or submenu, depending on the value passed for the new item. This constant is used to add a menu name to a menu bar or a menu item that opens a submenu to a drop-down menu, submenu, or shortcut menu.

MF_SEPARATOR

Draws a horizontal dividing line. This constant is used only in a drop-down menu, submenu, or shortcut menu. The line cannot be grayed, disabled, or highlighted.

MF_SEPARATOR cannot be used with MF_OWNERDRAW.

MF_STRING

Specifies that the menu item is a text string.

MF_STRING cannot be used with MF_OWNERDRAW.

MF_UNCHECKED

Does not place a check mark next to the menu item (default).

MF_UNCHECKED cannot be used with the MF_CHECKED constant.

MF_UNHILITE

Removes highlighting from the menu item.

MF_UNHILITE cannot be used with the MF_HILITE constant.

See Also

Reference

Menu Reference