Setting Up the Toolbar

 < Free Open Study > 



Adding the User Interface

I am going to assume that you have either created a new add-in by now or that you have opened the one that I have provided for you in the code for this chapter that you can download from the Apress Web site (http://www.apress.com).

The first thing you'll want to do is add the user interface to the add-in. Recall that I advised you not to have the Add-in Wizard create a user interface menu for you. In Chapter 7, I said that I recommend using the Microsoft Office Command object model rather than using the .NET-provided interface methods. I feel that the Office model offers more flexibility and the commands are not stored in the registry like the .NET commands are.

Note 

Commands created through the .NET Command object are somehow stored in the registry. However, the methodology for storing them is not documented, and they are obviously encrypted or at least stored in Unicode format. Therefore, a search of the registry will not yield a find on any of the .NET commands. This makes them very difficult to locate, and if you are not careful, you will clutter the registry with these commands with no apparent way of cleaning them out of the registry. For that reason, I do not recommend their use unless your add-in needs only one or two menus.

For the NET Desktop add-in you are moving away from the use of the TreeView control that you have used in previous add-ins. You are going to use the Office CommandBar and associated buttons for the top-level menu. You are going to use context pop-up menus for the drop-down menus for each major menu. You have to do this because the Office DropDown menu style from a tool button is not implemented for Visual Basic add-ins. However, I am going to show you how to make the Windows Forms perform as drop-down menus and appear just as they would if you were able to use the DropDown style.

Note 

If you do not care for this fairly complex method of creating a user interface, I suggest that you use the Office menu controls shown in Chapter 7.You can add multilevel menus to the Tools menu by using the code presented in that chapter.

In order to create this menu scheme, you must first decide how many tool buttons and submenus you are going to have. Obviously, as you add new functionality to an application, including an add-in, you will think of features that you did not design in at the inception of development. However, let's attempt to anticipate all of the features that this add-in will have up front, so that the initial user interface will accurately show the features you will have in the final add-in.



 < Free Open Study > 



Writing Add-Ins for Visual Studio  .NET
Writing Add-Ins for Visual Studio .NET
ISBN: 1590590260
EAN: 2147483647
Year: 2002
Pages: 172
Authors: Les Smith

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net