A .NET Technology blog | .NET,C# Progamming,C# tutorials,WPF WCF|Software Engineer


Custom controls in C#.NET

Custom controls are mainly created as extended version of available controls.In .NET framework,all control(like TextBox,Button,Panel etc.) classes are defined in such a way that user can derive specialized control from them.Custom control must either be derived from the specific control which you need to extend for your specific custom need or it directly derives from Control class.That means directly or indirectly a custom control is derived from Control. You can add additional properties,methods,events and also override the existing base class members.

Custom controls are of three types derived custom control,derived custom control and full custom control.

Derived custom controls are created by deriving an existing Control like TextBox,Button etc. to have certain specific features added apart from the out of the box available features.

Composite custom controls are formed by combining two or more controls.For instance Label and text box can be combined in to a composite control.

The third type,Full custom control, is a fresh control by yourself by deriving from the base class Control directly.

User Control on the other hand is a combination of multiple available controls to achieve isolated implementation of certain specific part of your forms which later added as controls to the form.

User Controls and Custom Controls are normally made as separate control library so that it is reusable to any no number of applications.It improves code quality,maintainability and reduces coupling.

How to make custom controls in C# Winforms


Add comment

  Country flag

  • Comment
  • Preview