DesignerOptionService Class
Provides a base class for getting and setting option values for a designer.
System.ComponentModel.Design::DesignerOptionService
System.Windows.Forms.Design::WindowsFormsDesignerOptionService
Assembly: System (in System.dll)
The DesignerOptionService type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | DesignerOptionService | Initializes a new instance of the DesignerOptionService class. |
| Name | Description | |
|---|---|---|
![]() | CreateOptionCollection | Creates a new DesignerOptionService::DesignerOptionCollection with the given name and adds it to the given parent. |
![]() | 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.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | PopulateOptionCollection | Populates a DesignerOptionService::DesignerOptionCollection. |
![]() | ShowDialog | Shows the options dialog box for the given object. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() ![]() | IDesignerOptionService::GetOptionValue | Gets the value of an option defined in this package. |
![]() ![]() | IDesignerOptionService::SetOptionValue | Sets the value of an option defined in this package. |
The DesignerOptionService class provides a collection of options. Each of these option collections has an indexer that enables it to be further filtered. Each option collection contains its own set of options, as well as a rollup of all of its child options. In the event of a naming conflict between properties, the outermost options object takes precedence. The following Tools | Options user interface (UI) structure shows how the outermost options object takes on greater importance:
WindowsFormsDesigner | General
SnapToGrid
ShowGrid
GridSize
Given a IDesignerOptionService named service, to get to the value of the GridSize property, you would make the following call:
This works, until you want to move GridSize to another page. Also, IDesignerOptionService provides no discovery mechanism. If you do not know what string to pass in, the service cannot find the property value.
The DesignerOptionService class addresses these issues. You can query collections, and there is a type converter defined on the DesignerOptionService::DesignerOptionCollection object that marks the collection as expandable. With this type converter, you can pass the entire designer option service to a property window and visually inspect the service.
Note |
|---|
The HostProtectionAttribute attribute applied to this type or member has the following Resources property value: SharedState. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes. |
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.
