DesignerAutoFormatCollection Class
Represents a collection of DesignerAutoFormat objects within a control designer. This class cannot be inherited.
Assembly: System.Design (in System.Design.dll)
The DesignerAutoFormatCollection type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | DesignerAutoFormatCollection | Initializes a new instance of the DesignerAutoFormatCollection class. |
| Name | Description | |
|---|---|---|
![]() | Count | Gets the number of DesignerAutoFormat objects in the collection. |
![]() | Item | Gets or sets a DesignerAutoFormat object at the specified index in the collection. |
![]() | PreviewSize | Gets the maximum outer dimensions of the control as it will appear at run time. |
![]() | SyncRoot | Gets an object that can be used to synchronize access to the DesignerAutoFormatCollection object. |
| Name | Description | |
|---|---|---|
![]() | Add | Adds the specified DesignerAutoFormat object to the end of the collection. |
![]() | Clear | Removes all formats from the collection. |
![]() | Contains | Determines whether the specified format is contained within the collection. |
![]() | 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.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | IndexOf | Returns the index of the specified DesignerAutoFormat object within the collection. |
![]() | Insert | Inserts a DesignerAutoFormat object into the collection at the specified index. |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | Remove | Removes the specified DesignerAutoFormat object from the collection. |
![]() | RemoveAt | Removes the DesignerAutoFormat object at the specified index within the collection. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() | AsParallel | Enables parallelization of a query. (Defined by ParallelEnumerable.) |
![]() | AsQueryable | Converts an IEnumerable to an IQueryable. (Defined by Queryable.) |
![]() | Cast<TResult> | Converts the elements of an IEnumerable to the specified type. (Defined by Enumerable.) |
![]() | OfType<TResult> | Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.) |
| Name | Description | |
|---|---|---|
![]() ![]() | ICollection::CopyTo | Infrastructure. Copies the elements of the collection to an Array object, starting at a particular Array index when the DesignerAutoFormatCollection object is cast to an ICollection interface. |
![]() ![]() | ICollection::Count | Infrastructure. Gets the number of elements that are contained in the collection when the DesignerAutoFormatCollection object is cast to an ICollection interface. |
![]() ![]() | ICollection::IsSynchronized | Infrastructure. Gets a value that indicates whether access to the collection is synchronized (thread safe) when the DesignerAutoFormatCollection object is cast to an ICollection interface. |
![]() ![]() | IEnumerable::GetEnumerator | Infrastructure. Returns an IEnumerator interface that iterates through the collection when the DesignerAutoFormatCollection object is cast to an IEnumerable interface. |
![]() ![]() | IList::Add | Infrastructure. Adds an item to the collection when the DesignerAutoFormatCollection object is cast to an IList interface. |
![]() ![]() | IList::Contains | Infrastructure. Determines whether the collection contains a specific value when the DesignerAutoFormatCollection object is cast to an IList interface. |
![]() ![]() | IList::IndexOf | Infrastructure. Determines the index of a specific item in the collection when the DesignerAutoFormatCollection object is cast to an IList interface. |
![]() ![]() | IList::Insert | Infrastructure. Inserts an item into the collection at the specified index when the DesignerAutoFormatCollection object is cast to an IList interface. |
![]() ![]() | IList::IsFixedSize | Infrastructure. Gets a value that indicates whether the collection has a fixed size when the DesignerAutoFormatCollection object is cast to an IList interface. |
![]() ![]() | IList::IsReadOnly | Infrastructure. For a description of this method, see IsReadOnly. |
![]() ![]() | IList::Item | Infrastructure. Gets the element at the specified index when the DesignerAutoFormatCollection object is cast to an IList interface. |
![]() ![]() | IList::Remove | Infrastructure. Removes the first occurrence of a specific object from the collection when the DesignerAutoFormatCollection object is cast to an IList interface. |
![]() ![]() | IList::RemoveAt | Infrastructure. Removes the item at the specified index when the DesignerAutoFormatCollection object is cast to an IList interface. |
The ControlDesigner class and any derived class defines the AutoFormats property as a DesignerAutoFormatCollection object. Control developers can override the AutoFormats property in a derived control designer, add custom automatic formatting styles, and return the collection of supported formats to the visual designer.
The collection dynamically increases as objects are added. Indexes in this collection are zero-based. Use the Count property to determine how many automatic style formats are in the collection.
Additionally, use the DesignerAutoFormatCollection methods and properties to provide the following functionality:
The Add method to add a single format to the collection.
The Insert method to add a format at a particular index within the collection.
The Remove method to remove a format.
The RemoveAt method to remove the format at a particular index.
The Contains method to determine whether a particular format is already in the collection.
The IndexOf method to retrieve the index of a format within the collection.
The Item property to get or set the format at a particular index, using array notation.
The Clear method to remove all formats from the collection.
The Count property to determine the number of formats in the collection.
The IndexOf method to get the position of a format within the collection.
The following code example demonstrates how to implement the AutoFormats property 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.






