How to create and set up CommandBars
When using the Windows Forms designer, CommandBars are created only through an instance of the CommandBarController class and never directly. The following sequence highlights the steps involved in creating and initializing the CommandBars:
1. Select the CommandBarController item from the Visual Studio.NET toolbox and add the component to the design form’s component tray.
2. Using either the CommandBarController’s AddCommandBar and RemoveCommandBar design-time verbs or the CommandBarController.CommandBars property collection editor, add the required CommandBars to the form.
3. Select each CommandBar in turn and using the property browser set its Appearance and Behavior attributes to achieve the desired visual effect and behavior. Please refer to the Essential Tools User’s Guide and Class Reference documentation for detailed information on how each of these properties affect the CommandBar.
4. Set the Layout attributes for each of the CommandBars. Layout attributes control the CommandBar bounds. Set the CommandBar’s MaxLength property to be equal to the width of the client control and the MinHeight property to be equal to the client’s height.
5. Select the client controls and drag-and-drop them onto the client region of the CommandBars. This adds the selected control to the respective CommandBar’s controls collection and resizes it to fit the CommandBar’s client bounds.
6. CommandBars can now be dragged around and docked/floated at the final location. The CommandBar position information is persisted by the designer and applied when the application is loaded.