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

NameDescription
CMFCDisableMenuAnimation::CMFCDisableMenuAnimationConstructs a CMFCDisableMenuAnimation object.
CMFCDisableMenuAnimation::~CMFCDisableMenuAnimationDestructor.

Public Methods

NameDescription
CMFCDisableMenuAnimation::RestoreRestores the previous animation that the framework used to display a pop-up menu.

Data Members

NameDescription
CMFCDisableMenuAnimation::m_animTypeStores 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.
   }

CMFCDisableMenuAnimation

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.

Hierarchy Chart
Classes
CMFCPopupMenu Class

Show: