Dela via


How to: Access Design-Time Support in Windows Forms

Caution

This content was written for .NET Framework. If you're using .NET 6 or a later version, use this content with caution. The designer system has changed for Windows Forms and it's important that you review the Designer changes since .NET Framework article.

Your custom components and controls are designable, which means they have settings that users can configure with a graphical user interface (UI) at design time. These settings usually affect instances of the component at run time.

If your class implements the IComponent interface, it can participate in a design environment like Visual Studio.

To access the design-time support provided by the .NET Framework, you need to complete the following steps.

Note

You must add a reference to the design-time assembly, System.Design.dll. This assembly is not included in the .NET Framework 4 Client Profile. To add a reference to System.Design.dll, you must change the project's Target Framework to .NET Framework 4.

To access design-time support

  1. Add a reference to the System.Design assembly.

  2. If you are implementing a UITypeEditor or if your component is interacting with a Toolbox or PropertyGrid control, import the System.Drawing.Design namespace.

    Imports System.Drawing.Design
    
    using System.Drawing.Design;
    
  3. If you are implementing a custom design-time experience for your component, import the System.ComponentModel.Design namespace.

    Imports System.ComponentModel.Design
    
    using System.ComponentModel.Design;
    
  4. If you are implementing a custom design-time experience for your Windows Forms control, import the System.Windows.Forms.Design namespace. You can create smart tags or a custom designer for your component with types in this namespace.

    Imports System.Windows.Forms.Design
    
    using System.Windows.Forms.Design;
    

See Also

Tasks

How to: Attach Smart Tags to a Windows Forms Component

Concepts

Design-Time Architecture

Other Resources

Extending Design-Time Support

User Interface Type Editors