C# Display Custom Controls in Designer
( January 12th, 2013 Tips & Tricks ) - lo-fi/printable version

In many of our projects we might want to create custom controls (that means customized textboxes/buttons/panels and many other). To make application designing easier, we can also add those custom controls in Designer View and in the ToolBox.
 

Custom Control in Designer View

How to?

Let’s say we want to add Designer support for this custom button:

 

In order to do this you have to follow those 2 steps:

1) Include this namespace:

2) Add right before your class header this line:

This will add the custom button in the ToolBox (where the default controls are shown) – all you have to do now is simply drag and drop the control in your form and it will be rendered acording to it’s class (which is MyCustomButton).
 

The code should look like this:


No comments yet.
Have something to say?