.Net - Explain with code sample how to create a custom
control. - June 03, 2009 at 11:00 AM by Shuchi Gauri
Explain with code sample how to create a custom control.
Steps to create a custom control:
a. Create a new project.
b. Add a custom control to the project.
c. Change the name of the class you need to inherit the control from the base
class. E.g. inherit the class from System.Windows.Forms.Button if the control s
to be inherited from a button class.
d. Implement the control with custom properties and featured needed by the
e. Override the OnPaint method if the control’s appearance needs to be changed.
f. Save the build the control
g. Reference you control into another or the same project and use the control.
Custom controls are user defined controls. They can be created by grouping
existing controls, by deriving the control from
System.Web.UI.WebControls.WebControl or by enhancing the functionality of any
other custom control............
User authored controls are which not part of the .net framework library. It
includes both custom controls and user controls........
Steps to create inherited Control:-........
Steps to create a User control:.........