Hi,
I'm using the following code to create my own menu within Visual Studio
..NET. Therefore, I would like to be able to add submenu but could not find
any explanation on how to do it.
InitMenuBarItems("&My Tool Menu")
MenuItemTemplateClass = CreateButton(DirectCast(MenuBarItem,
CommandBarPopup),"My Command", MsoControlType.msoControlButton)
MenuItemTemplateClass.ShortcutText = "Shift+ Ctrl+M"
// Create the Main Menu Item
Private Sub InitMenuBarItems(ByVal inCaption As String)
MainMenuBar = applicationObject.CommandBars("MenuBar")
MenuBarItem = MainMenuBar.Controls.Add(MsoControlType.msoControl Popup,
Before:=MainMenuBar.Controls.Item("Tools").Index, Temporary:=True)
MenuBarItem.Caption = inCaption
End Sub
// Create the Command associated to the main menu
Private Function CreateButton(ByVal inParent As CommandBarPopup, ByVal
inCaption As String, ByVal inType As MsoControlType) As Object
Dim commandBarCtrl As CommandBarControl
commandBarCtrl = inParent.Controls.Add(inType, Temporary:=True)
commandBarCtrl.Caption = inCaption
commandBarCtrl.Visible = True
Return commandBarCtrl
End Function
Under "My Command", i would like to be able to add a submenus to have the
following tree:
My Tool Menu
|
|- My Command
|- My Submenu
|
|- My Submenu Command
If anyone knows how to perform this, just let me know. Probably I'm not
creating my menus the proper way.
Thanks.
--
F. Chouinard