What's New in Design-Time Support in the .NET Framework 2.0
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.
The .NET Framework 2.0 extends the .NET Framework 1.1 with new features, improvements to existing features, and enhancements to design-time development. This topic provides a summary of new designer features.
Toolbox Improvements
The Toolbox in Visual Studio now organizes components and controls into categories. It is also automatically populated with your project's components and controls.
DesignerAction Support
The DesignerAction feature enables components and controls to display context-sensitive information and commands. The DesignerAction feature can be thought of as a replacement for designer verbs, because a DesignerActionItem can be displayed in the smart-tag panel and also in the shortcut menu associated with a component or control. The DesignerActionList class represents the main point of interaction for developers wanting to add smart-tag support to their custom components and controls. For more information, see How to: Attach Smart Tags to a Windows Forms Component.
Designer Layout Assistance for Windows Forms
Improved layout support is now available for the run time and design environments.
Design Environment
Windows Forms controls support snaplines, which enable easy alignment of controls on your form. The SnapLine class gives you an implementation to extend your custom controls with snaplines.
For more information, see Walkthrough: Arranging Controls on Windows Forms Using Snaplines and Walkthrough: Arranging Controls on Windows Forms Using Snaplines and Walkthrough: Arranging Controls on Windows Forms Using Snaplines and Walkthrough: Arranging Controls on Windows Forms Using Snaplines..
Run Time
TableLayoutPanel and FlowLayoutPanel are two new Windows Forms controls which enable scenarios that require proportional resizing and dynamic layout capabilities. For more information, see TableLayoutPanel Control (Windows Forms) and FlowLayoutPanel Control (Windows Forms).
You can implement your own custom layout behavior using the Control.LayoutEngine property and the LayoutEngine class. For more information, see How to: Implement a Custom Layout Engine.
Default Interface Implementations
Many of the interfaces specifying designer infrastructure now have default implementations which you can extend. The following table shows a list of the base classes along with their corresponding default implementations.
Base class |
Implements |
---|---|
Designer Base Class Implementations
The following table shows the classes that implement designer infrastructure that are now available for you to use and extend.
Base Class |
Description |
---|---|
Provides a base class for CodeDomSerializer classes. |
|
Serializes a set of components or serializable objects into a serialization store. |
|
Provides a base class for the container filter service. |
|
Provides supplemental metadata to TypeDescriptor. |
Designer Services
The designer infrastructure offers an expanded set of designer services to help you build a rich design experience for your customers. For more information, see Design-Time Architecture.
Designer Appearance and Behavior Factoring for Windows Forms
In earlier versions of the .NET Framework, custom Windows Forms designers contained all the mouse-handling and keyboard-handling logic. The new Glyph, Behavior, and Adorner classes enable refactoring your appearance and behavior code into dedicated custom types. For more information, see How to: Extend the Appearance and Behavior of Controls in Design Mode.
TypeDescriptor Extensions
The TypeDescriptionProvider class implements extensibility for the TypeDescriptor class. This enables a number of advanced scenarios, including instance substitution, metadata substitution, attribute redirection, and target substitution and shadowing.
For more information, see Type Descriptor Overview.
Generic Undo/Redo Support
The UndoEngine class provides generic undo/redo support for property value changes on components. The DesignerTransaction class enables transactional processing on discrete work units that you can commit or roll back. You can make a series of changes to your components, then accept or cancel them all at once.
Code Examples
The Windows Software Development Kit (SDK) now has more code examples demonstrating custom designer development. For more information, see Programming with Components How-to and Walkthrough Topics and Extending Design-Time Support How-to and Walkthrough Topics.
Topic | Location |
---|---|
Developing Windows Forms Controls at Design Time | Windows Forms Controls |
Developing Windows Forms Controls at Design Time | Windows Forms Controls |
Developing Windows Forms Controls at Design Time | Windows Forms Controls |
Developing Windows Forms Controls at Design Time | Windows Forms Controls |