DesignerAutoFormat Class
Provides the abstract base class for creating formats that can be applied to a custom Web server control at design time.
Assembly: System.Design (in System.Design.dll)
The DesignerAutoFormat type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | Name | Gets the name of a DesignerAutoFormat object. |
![]() | Style | Gets a DesignerAutoFormatStyle object that is used by the DesignerAutoFormat object to render a design-time preview of the associated control. |
| Name | Description | |
|---|---|---|
![]() | Apply | Applies the associated formatting to the specified control. |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetPreviewControl | Returns a copy of the associated control in order to provide a preview before applying the format to the control. |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current DesignerAutoFormat object. (Overrides Object::ToString().) |
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.
When you inherit from the DesignerAutoFormat class, you must override the Apply method to preview a formatted control and to apply the selected format to your control.
The following code example demonstrates how to implement automatic formatting in a custom control designer. The derived control designer implements the AutoFormats property by adding three instances of a custom automatic format that are derived from the DesignerAutoFormat class.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.


