Custom menu

M

Michael Morse

Could some please post some basic code that can add a custom menu, a menu
item and attach it to an event handler that pops a message box. I'm
stuggling like crazy here. Seems there is so many ways to achive this.
 
A

Al Edlund

I considered posting it, but, it's all notated and quite large. Since the
sdk gives examples in several languages, and you didn't post your favorite,
the size starts to grow exponentially. Finally then we get slapped for not
completing exactly what is wanted by the user. Happy to help, but some of my
peers write code for a living.
;-)
al
ps You also didn't say what version of Visio you needed help in.
 
M

Michel LAPLANE \(MVP\)

Here are some line in C#

// Add commandbar for this Visio session
applicationCommandBars =
(CommandBars)visioApplication.CommandBars;
// Get active menubar
menuBar = applicationCommandBars.ActiveMenuBar;
// add a menu to the end
menuPopup =
(CommandBarPopup)menuBar.Controls.Add(MsoControlType.msoControlPopup,
System.Type.Missing,
System.Type.Missing,
System.Type.Missing,
true);
// Set the menu properties.
setMenuProperties(menuPopup, strMenuTitle,
strMenuToolTip, strMenuTag);
// Add the item
menuItem =
(CommandBarButton)menuPopup.Controls.Add(MsoControlType.msoControlButton,
System.Type.Missing,
System.Type.Missing,
System.Type.Missing,
false);
// Set the item properties.
setItemProperties(menuItem, strTitle, strTooltip, strTag, bIsGroup);
// Add a Click event handler.
menuItem.Click += new
_CommandBarButtonEvents_ClickEventHandler(menu_Click);

Enjoy with C#
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top