The Label control allows text to be displayed programmatically on a Web page.

In a visual designer, when you switch from Source to Design view, the markup source code that describes a Label control is parsed and a design-time version of the control is created on the design surface. When you switch back to Source view, the design-time control is persisted to the markup source code and edited into the markup for the Web page. The LabelDesigner class provides design-time support for the Label control.

The OnComponentChanged method is called when there is a change to the associated Label control.

The following code example shows how to derive the SampleLabel control from the Label control, and applies a DesignerAttribute attribute on the SampleLabel control to associate it with the SampleLabelDesigner class.

The code example also derives the SampleLabelDesigner from the LabelDesigner class. It overrides the GetDesignTimeHtml method to set the BorderStyle property to Dashed, if the original BorderStyle was the NotSet or None value. This improves the visibility of the associated control at design time.