DesignerAutoFormat Class
Assembly: System.Design (in system.design.dll)
DesignerAutoFormat provides a base class that can be inherited from and extended to display a formatted custom Web server control at design time in a visual designer tool such as Visual Studio 2005.
A control developer provides automatic formatting in order to help developers who use the control to select a preferred display. A custom DesignerAutoFormat object works with a custom control designer to provide automatic formatting at design time for a custom control. For example, the Calendar control provides a variety of formats that can be applied by a developer at design time.
To implement automatic formatting for a custom control:
-
Create the custom control.
-
Derive a designer class from the ControlDesigner class or another designer class that is appropriate for your control, such as the TextControlDesigner.
-
Derive a format class from the DesignerAutoFormat class that formats your custom control by overriding the Apply method.
-
In your designer class, populate the AutoFormats property, which is a DesignerAutoFormatCollection object, with one instance of your format class for each named format that your designer can apply.
The DesignerAutoFormat class provides the following members to support automatic formatting at design time:
-
The Apply method, which applies the named format to the specified control.
-
The GetPreviewControl method, which provides a copy of the control for previewing in an AutoFormat dialog box of a visual designer such as Visual Studio 2005.
-
The Name property, which provides the text to display in a list of formats in a visual designer.