Using your own control instead of Toolbars.

In the previous chapter, we have shown you how you can use your own tool-strip control to host some of the toolbar buttons selectively. Sometimes, you might think about calling the same methods (that are executed when a toolbar button is clicked) from your own control. For example, if you have a button in your Windows Form where you want that, if that button is clicked, the Image Insert Dialog should be shown as if the user pressed the image toolbar button. Yes, you can call any toolbar button's logic just from your own control.

Here is the snippet about how to call the Image Dialog logic from your own button control. (say your button name is button1).


Yes, all other Toolbar button click methods can be found in the ToolbarItemOverrider collection.

Here is a screenshot of the Visual Studio intellisense for this collection.


So, lets design a form with 3 buttons, Bold, Italic and Underline as shown in the following screenshot:


Lets their name be btnBold, btnItalic and btnUnderline and their click event handlers can be written as





Last updated on 27 June 2012, Wednesday, 4:19:56 PM
If you have any questions or concerns about this tutorial, Please feel free to share your comment.