共用方式為


Custom Designers

The .NET Framework provides the ability to provide custom behavior for a type of component while it is in design mode. Designers are classes that provide logic that can adjust the appearance or behavior of a type at design time. All designers implement the System.ComponentModel.Design.IDesigner interface. Designers are associated with a type or type member through a DesignerAttribute. A designer can perform tasks at design time after a component or control with which a designer is associated has been created.

Designers can be built to perform a variety of types of tasks in design mode. Designers can:

  • Alter and extend the behavior or appearance of components and controls in design mode.

  • Perform custom initialization for a component in design mode.

  • Access design-time services and configure and create components within a project.

  • Add menu items to the shortcut menu of a component.

  • Adjust the attributes, events, and properties exposed by a component with which the designer is associated.

Designers can serve an important role in assisting with the arrangement and configuration of components, or to enable proper behavior for a component in design mode that otherwise depends on services or interfaces available only at run time.

Some controls may require visual cues in design mode to make configuration easier. For example, a System.Windows.Forms.Panel object might not have a visible border at run time. Without a border, the panel is not visible on a form with the same background color. Therefore, the designer for the System.Windows.Forms.Panel object draws a dotted-line border around the panel.

The System.ComponentModel.Design namespace provides the basic interfaces that developers can use to build design-time support.

In This Section

  • Base Designer Classes
    Describes classes and interfaces you can use to build a custom design-time user interface (UI).
  • Metadata Filtering
    Describes how to modify the set of properties, attributes and events exposed by a component or control at design time.
  • Designer Verbs
    Describes how to add menu commands to the shortcut menu for components at design time.

See Also

Other Resources

Extending Design-Time Support