This documentation is archived and is not being maintained.

How to: Adjust the Attributes, Events, and Properties of a Component in Design Mode

You can use your custom designer to modify the attributes, events, and properties of your component in design mode.

The following code example demonstrates how to create a custom designer that adjusts a component's attributes, events, and properties. A designer class called DemoControlDesigner is attached to a DemoControl class and performs the following operations:

  • Adds a property to the DemoControl class.

  • Removes a property from the DemoControl class.

  • Shadows a property of the DemoControl class.

  • Changes attributes of a DemoControl class property

  • Creates a component on the design surface and attaches an event handler.

No code example is currently available or this language may not be supported.

You can change the attributes, events, and properties of your component in design mode by overriding the following methods on your designer:

The following code example demonstrates how to override the PreFilterProperties and

PostFilterProperties methods to change the properties and attributes of the DemoControl class.

No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.

When you make changes to the design-time aspects of a component, you need to rebuild the control project. In addition, if there is another Windows Forms project that is currently open and uses this component, you will probably need to refresh the project to see the changes. Typically, you need to close and reopen the design window containing the component.

Note 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.

Show: