次の方法で共有


CMFCPopupMenuBar Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CMFCPopupMenuBar Class.

A menu bar embedded into a pop-up menu.

Syntax

class CMFCPopupMenuBar : public CMFCToolBar  

Members

Public Methods

Name Description
CMFCPopupMenuBar::AdjustSizeImmediate Immediately recalculates the layout of a pane. (Overrides CPane::AdjustSizeImmediate.)
CMFCPopupMenuBar::BuildOrigItems Loads popup menu items from a specified menu resource.
CMFCPopupMenuBar::CloseDelayedSubMenu Closes a delayed popup menu button.
CMFCPopupMenuBar::ExportToMenu Builds a menu from the popup-menu buttons.
CMFCPopupMenuBar::FindDestintationToolBar Locates the toolbar where a specified point lies.
CMFCPopupMenuBar::GetCurrentMenuImageSize Indicates the size of menu-button images.
CMFCPopupMenuBar::GetDefaultMenuId Returns the identifier of the default menu item.
CMFCPopupMenuBar::GetLastCommandIndex Gets the index of the most recently invoked menu command.
CMFCPopupMenuBar::GetOffset Gets the row offset of the popup menu bar.
CMFCPopupMenuBar::ImportFromMenu Imports popup menu buttons from a specified menu.
CMFCPopupMenuBar::IsDropDownListMode Indicates whether the popup menu bar is in drop-down-list mode.
CMFCPopupMenuBar::IsPaletteMode Indicates whether the popup menu bar is in palette mode.
CMFCPopupMenuBar::IsRibbonPanel Indicates whether this is a ribbon panel ( FALSE by default).
CMFCPopupMenuBar::IsRibbonPanelInRegularMode Indicates whether this is a ribbon panel in regular mode ( FALSE by default).
CMFCPopupMenuBar::LoadFromHash Loads an archived menu.
CMFCPopupMenuBar::RestoreDelayedSubMenu Restores a delayed menu button for closing the popup menu bar.
CMFCPopupMenuBar::SetButtonStyle Sets the style of the toolbar button at the given index. (Overrides CMFCToolBar::SetButtonStyle.)
CMFCPopupMenuBar::SetOffset Sets the row offset of the popup menu bar.
CMFCPopupMenuBar::StartPopupMenuTimer Starts the timer for a specified delayed popup menu button.

Data Members

Name Description
CMFCPopupMenuBar::m_bDisableSideBarInXPMode Specifies whether the gray sidebar will be displayed when the application has a Windows XP appearance.

Remarks

The CMFCPopupMenuBar is created at the same time as a CMFCPopupMenu Class and embedded inside it. The CMFCPopupMenuBar covers the entire client area of the CMFCPopupMenu object. It supports keyboard and mouse input. It also communicates that input to the CMFCPopupMenu and to the top-level frame window.

Example

The following example demonstrates how to initialize a CMFCPopupMenuBar object from a CMFCPopupMenu object. This code snippet is part of the Draw Client sample.

   // CMFCPopupMenu* pMenuPopup
    CMFCPopupMenuBar* pMenuBar = pMenuPopup->GetMenuBar();

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CBasePane

CPane

CMFCBaseToolBar

CMFCToolBar

CMFCPopupMenuBar

Requirements

Header: afxpopupmenubar.h

CMFCPopupMenuBar::AdjustSizeImmediate

Immediately recalculates the layout of the popup menu bar pane. (Overrides CPane::AdjustSizeImmediate.

virtual void AdjustSizeImmediate(BOOL bRecalcLayout);

Parameters

[in] bRecalcLayout
TRUE to automatically recalculate the layout of the popup menu bar pane; otherwise, FALSE.

Remarks

CMFCPopupMenuBar::BuildOrigItems

Loads popup menu items from a specified menu resource.

BOOL BuildOrigItems(UINT uiMenuResID);

Parameters

[in] uiMenuResID
Specifies the menu ID of the menu resource to load.

Return Value

Returns TRUE if successful or FALSE if not.

Remarks

CMFCPopupMenuBar::CloseDelayedSubMenu

Closes a popup menu button that has been delayed.

virtual void CloseDelayedSubMenu();

Remarks

CMFCPopupMenuBar::ExportToMenu

Builds a menu from the popup menu buttons.

virtual HMENU ExportToMenu() const;  

Return Value

Returns a handle to the new menu.

Remarks

CMFCPopupMenuBar::FindDestintationToolBar

Locates the toolbar where a specified point lies.

CMFCToolBar* FindDestintationToolBar(CPoint point);

Parameters

[in] point
A point on the screen.

Return Value

Returns a handle to the toolbar where the point lies, if therei is one, or NULL if not.

Remarks

CMFCPopupMenuBar::GetCurrentMenuImageSize

Indicates the size of menu-button images.

virtual CSize GetCurrentMenuImageSize() const;  

Return Value

Returns the size of menu-button images in the toolbar.

Remarks

CMFCPopupMenuBar::GetDefaultMenuId

Returns the identifier of the default menu item.

UINT GetDefaultMenuId() const;  

Return Value

Returns the identifier of the default menu item in the popup menu bar.

Remarks

CMFCPopupMenuBar::GetLastCommandIndex

Gets the index of the most recently invoked menu command.

static int __stdcall GetLastCommandIndex();

Return Value

Returns the index of the last menu command that has been invoked.

Remarks

CMFCPopupMenuBar::GetOffset

Gets the row offset of the popup menu bar.

int GetOffset() const;  

Return Value

Returns the row offset of the popup menu bar.

Remarks

This value is set using CMFCPopupMenuBar::SetOffset.

CMFCPopupMenuBar::ImportFromMenu

Imports popup menu buttons from a specified menu.

virtual BOOL ImportFromMenu(
    HMENU hMenu,  
    BOOL bShowAllCommands = FALSE);

Parameters

[in] hMenu
The menu from which to import the popup menu buttons.

[in] bShowAllCommands
TRUE if all commands on the menu are to be imported, or FALSE if rarely used ones may be hidden.

Return Value

Returns TRUE if the menu buttons were successfully imported from the menu, or FALSE if not.

Remarks

CMFCPopupMenuBar::IsDropDownListMode

Indicates whether the popup menu bar is in drop-down-list mode.

BOOL IsDropDownListMode() const;  

Return Value

Returns TRUE if the popup menu bar is in drop-down-list mode, or FALSE if not.

Remarks

CMFCPopupMenuBar::IsPaletteMode

Indicates whether the popup menu bar is in palette mode.

BOOL IsPaletteMode() const;  

Return Value

Returns TRUE if palette mode is enabled, or FALSE if not.

Remarks

When the menu bar is set to palette mode, menu items appear in multiple columns and a limited number of rows.

CMFCPopupMenuBar::IsRibbonPanel

Indicates whether this is a ribbon panel ( FALSE by default).

virtual BOOL IsRibbonPanel() const;  

Return Value

Returns FALSE by default, indicating that this is not a ribbon panel.

Remarks

CMFCPopupMenuBar::IsRibbonPanelInRegularMode

Indicates whether this is a ribbon panel in regular mode ( FALSE by default).

virtual BOOL IsRibbonPanelInRegularMode() const;  

Return Value

Returns FALSE by default, indicating that this is not a ribbon panel in regular mode.

Remarks

CMFCPopupMenuBar::LoadFromHash

Loads an archived menu.

BOOL LoadFromHash(HMENU hMenu);

Parameters

[in] hMenu
A handle to the archived menu to load.

Return Value

Returns TRUE if the menu is loaded successfully, or FALSE if not.

Remarks

CMFCPopupMenuBar::m_bDisableSideBarInXPMode

A Boolean parameter that indicates whether your application has a gray sidebar when it has a Windows XP appearance.

BOOL m_bDisableSideBarInXPMode;  

Remarks

If this member variable is set to FALSE and your application has a Windows XP appearance, the framework draws a gray sidebar in your application.

The default value is FALSE.

CMFCPopupMenuBar::RestoreDelayedSubMenu

Restores a delayed menu button for closing the popup menu bar.

virtual void RestoreDelayedSubMenu();

Remarks

CMFCPopupMenuBar::SetButtonStyle

Sets the style of the toolbar button at the given index. (Overrides CMFCToolBar::SetButtonStyle.)

virtual void SetButtonStyle(
    int nIndex,  
    UINT nStyle);

Parameters

[in] nIndex
The zero-based index of the toolbar button whose style is to be set.

[in] nStyle
The style of the button. See ToolBar Control Styles for the list of available toolbar button styles.

Remarks

CMFCPopupMenuBar::SetOffset

Sets the row offset of the popup menu bar.

void SetOffset(int iOffset);

Parameters

[in] iOffset
The number of rows that the popup menu bar should be offset.

Remarks

CMFCPopupMenuBar::StartPopupMenuTimer

Starts the timer for a specified delayed popup menu button.

void StartPopupMenuTimer(
    CMFCToolBarMenuButton* pMenuButton,  
    int nDelayFactor = 1);

Parameters

[in] pMenuButton
Pointer to the menu button for which to set the delay timer.

[in] nDelayFactor
A delay factor, equal to at least one, to multiply by the standard menu delay time (generally between a half second and five seconds).

Remarks

See Also

Hierarchy Chart
Classes
CMFCColorBar Class
CMFCPopupMenu Class