CMFCDisableMenuAnimation 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 CMFCDisableMenuAnimation Class.
Disables pop-up menu animation.
class CMFCDisableMenuAnimation
Public Constructors
| Name | Description |
CMFCDisableMenuAnimation::CMFCDisableMenuAnimation | Constructs a CMFCDisableMenuAnimation object. |
CMFCDisableMenuAnimation::~CMFCDisableMenuAnimation | Destructor. |
Public Methods
| Name | Description |
| CMFCDisableMenuAnimation::Restore | Restores the previous animation that the framework used to display a pop-up menu. |
Data Members
| Name | Description |
CMFCDisableMenuAnimation::m_animType | Stores the previous pop-up menu animation type. |
Remarks
Use this helper class to temporarily disable pop-up menu animation (for example, when you process mouse or keyboard commands).
A CMFCDisableMenuAnimation object disables pop-up menu animation during its lifetime. The constructor stores the current pop-up menu animation type in the m_animType field and sets the current animation type to CMFCPopupMenu::NO_ANIMATION. The destructor restores the previous animation type.
You can create a CMFCDisableMenuAnimation object on the stack to disable pop-up menu animation throughout a single function. If you want to disable popup menu animation between functions, create a CMFCDisableMenuAnimation object on the heap and then delete it when you want to restore pop-up menu animation.
The following example shows how to use the stack to temporarily disable menu animation.
void CMyApp::ProcessCommand() { // Temporarily disable menu animation. CMFCDisableMenuAnimation disableMenuAnimation; // TODO: Process the command here. // When the CMFCDisableMenuAnimation object leaves scope, // the destructor will restore the previous animation type. }
Header: afxpopupmenu.h
Restores the previous animation that the framework used to display a pop-up menu.
void Restore ();
Remarks
This method is called by the CMFCDisableMenuAnimation destructor to restore the previous animation that the framework used to display a pop-up menu.