Articles in this section
Category / Section

How to create and set up CommandBars

1 min read

 

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.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied