Use the Forms Designer to design the layout of a composite control. This process is identical to designing the layout of a form. You can add controls from the Toolbox, move and size controls on the surface of the UserControl, specify properties, and create event handlers.
This scenario demonstrates how to create a composite control that contains a GroupBox control and a CheckBox control in the upper-left corner of the GroupBox control. When the composite control is placed on a form, you can add controls within the GroupBox portion of the control. When the CheckBox control is unchecked, the controls within the composite control are disabled; when the CheckBox control is checked, the controls within the composite control are enabled.
To add controls to the UserControl
If the Toolbox is not displayed, click Toolbox on the View menu.
A GroupBox control is added with the default name of groupBox1.
A CheckBox control is added with the default name of checkBox1. Ensure that the CheckBox control is contained within the GroupBox control.
To save screen space, it is important that you resize the UserControl. Because the UserControl can be resized, it is also important for the controls within the UserControl to resize when the dimensions of the UserControl change.
To set the size of the controls
The size of the UserControl's design surface is the default size of the control when it is added to a form.
The GroupBox control is now anchored to the borders of the UserControl.
To provide the user of the GroupCheck control with a correct display, modify the properties of the GroupBox and CheckBox controls that were added to the UserControl.
To set the properties of the controls
The next step is to add a property to your control.