How to: Inherit from the UserControl Class
To combine the functionality of one or more Windows Forms controls with custom code, you can create a user control. User controls combine rapid control development, standard Windows Forms control functionality, and the versatility of custom properties and methods. When you begin creating a user control, you are presented with a visible designer, upon which you can place standard Windows Forms controls. These controls retain all of their inherent functionality, as well as the appearance and behavior (look and feel) of standard controls. Once these controls are built into the user control, however, they are no longer available to you through code. The user control does its own painting and also handles all of the basic functionality associated with controls.
To create a user control
Create a new Windows Control Library project in Visual Studio.
A new project is created with a blank user control.
Drag controls from the Windows Forms tab of the Toolbox onto your designer.
These controls should be positioned and designed as you want them to appear in the final user control. If you want to allow developers to access the constituent controls, you must declare them as public, or selectively expose properties of the constituent control. For details, see How to: Expose Properties of Constituent Controls.
Implement any custom methods or properties that your control will incorporate.
Press F5 to build the project and run your control in the UserControl Test Container. For more information, see How to: Test the Run-Time Behavior of a UserControl.