Component Designer

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.

Allows you to add subcomponents to a class, configure them, and code their events. Using the designer, you can:

  • Add components and items from the Toolbox or from Server Explorer.

  • Group together a set of subcomponents into a single class.

  • Double-click the designer and write code in the general declarations section of the class, or double-click an element on the designer to write code for that element.

To display the designer, from the Project menu, select Add Component. The Add New Item dialog box appears. By default, the Component Class item is selected. Click OK to add a new component to your project and open the Component Designer.

You can also display the designer by selecting Windows Service or Installer Class in the Add New Item dialog box, by selecting an existing component in the Add Existing Item dialog box, or by opening a Windows service project.

The Component Designer acts as a design surface for all nonvisual classes, allowing you to use much the same model you do for visual elements. For example, when you add a button (a visual element) to the designer for a form, you see an icon representing that element and can click it to access its properties or double-click it to open the Code Editor. The Component Designer replicates this experience for nonvisual components. For example, you can drop a Timer component onto the Component Designer, click the Timer icon, and manipulate its properties via the Properties window and the Code Editor.

The Component Designer also appears as a tray at the bottom of some designers, such as the Web Forms Designer and the Windows Forms Designer. When you add a nonvisual item to the Web Forms Designer or Windows Forms Designer, an icon appears in a tray at the bottom of the designer. This tray acts as a collection point for nonvisual items, allowing you to work with them without interfering with the arrangement of controls on the page or form.

See Also

Tasks

Walkthrough: Authoring a Component with Visual Basic

Walkthrough: Authoring a Component with Visual C#

Reference

Toolbox, Components Tab

Other Resources

Programming with Components

Extending Design-Time Support