CMFCDisableMenuAnimation Class
Disables pop-up menu animation.
class CMFCDisableMenuAnimation
Name | Description |
---|---|
CMFCDisableMenuAnimation::CMFCDisableMenuAnimation |
Constructs a CMFCDisableMenuAnimation object. |
CMFCDisableMenuAnimation::~CMFCDisableMenuAnimation |
Destructor. |
Name | Description |
---|---|
CMFCDisableMenuAnimation::Restore | Restores the previous animation that the framework used to display a pop-up menu. |
Name | Description |
---|---|
CMFCDisableMenuAnimation::m_animType |
Stores the previous pop-up menu animation type. |
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 ();
This method is called by the CMFCDisableMenuAnimation
destructor to restore the previous animation that the framework used to display a pop-up menu.