Using your own toolbars

Sometimes, you may think about using your own toolbars so that you can place the toolbar buttons in your own way, your preferred orders and some selected buttons that you need. Say, for example, you want to use a toolbar which should contain only Bold, Italic and Underline button. Nothing else. The following steps explain how to do that.

Step 1. Select the toolbar 1 and toolbar 2 in design time and set their Visible property = false.

step 1

Step 2: Now, add your own toolbar in your windows form where you want to place your buttons. Say, the name of the toolStrip is toolstrip1.

step 2

Step 3: Now, handle the Load event of your Form and add following snippet to add only Bold, Italic and Underline button.

step 3

Thats all you needed to do. When your application runs, you will see the bold, italic and underline button. You do not need to add any click event handler or anything. Everything will be done automatic. Not only that, whenever, you place your cursor on a text which is bold, your added bold button will be active.

step 4

Q: What buttons are available to add ?

Answer : All buttons that comes with the factory toolbars are available to add to your own toolbars from the ToolbarItemOverrider.ToolbarItems. collection. Here is a screenshot of the Visual Studio intellisense for this collection.

toolbar_items




Last updated on 19 September 2014, Friday, 1:10:44 PM
If you have any questions or concerns about this tutorial, Please feel free to share your comment.