Toll Free: (877) 723-1442 U.S. and Canada
Support
ActiveX / COM
Visual C++ / MFC
Customer Spotlight
Corporate Partners
Contact Sales

Call center available M-F 9:00 - 6:00 US Eastern Time.

U.S. and Canada
(877) 723-1442

International
(517) 625-5729

Email

Removing ToolBars from the Context Menu

Author: Mike Palmatier
Posted: February 7, 2006
Environment: Visual Basic 6.0

When you right-click on any area of the CommandBars a Context Menu is displayed with the name of all the ToolBars that have been added. This menu allows you to hide or display a toolbar. By default, all ToolBars are added to this menu. To remove a ToolBar from the menu, set the CommandBars.ContextMenuPresent property to False. To completely remove the Context Menu, you need to remove the entry for ToolBars.



The code below will remove the first toolbar from the ContextMenu.

 

 CommandBars(2).ContextMenuPresent = False

 



The code below will remove all toolbars from the ContextMenu, which will in effect "disable" the menu. This is useful when you want to display your own context menu instead of the standard one.

 Private Sub CommandBars_ToolBarContextMenu(ByVal ToolBar As XtremeCommandBars.ICommandBar, ByVal ContextMenu As XtremeCommandBars.ICommandBar)

     ContextMenu.Controls.DeleteAll

 End Sub

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Other products and/or company names may be trademarks or registered trademarks of their respective owners.