Поделиться через


Implementing a UI Type Editor

In some situations, a simple value-to-string conversion that allows a property to be displayed as text in the property browser might not be adequate. Also, a string-to-value configuration style may not be adequate for some types. For instance, in the case of a color property, a visual representation is more desirable. A UI type editor can provide a visual representation of a property value in a property grid control, such as a design-time property browser. A UI type editor can also provide a custom user interface for configuring the value or values of an object of a particular type.

**Note   **An EditorAttribute is applied to a type or to a property to associate the type or the property with a UI type editor.

To implement a custom UI type editor for Windows Forms

  1. Define a class that derives from System.Drawing.Design.UITypeEditor.
  2. Override the EditValue method to set up properties of the user interface. This method is overloaded.
  3. Override the GetEditStyle method to inform the property browser about the editing support that you will provide.

For a complete sample, see the UI Type Editor for Windows Forms Sample.

See Also

Enhancing Design-Time Support | UI Type Editor for Windows Forms Sample | UITypeEditor