Provides a base implementation of a toolbox item.
Assembly: System.Drawing (in System.Drawing.dll)
is a base class for toolbox items that can be displayed in the toolbox of a design-time environment. A toolbox item typically represents a component to create when invoked on a design mode document. The class provides the methods and properties needed to provide the toolbox with the display properties for the toolbox item, to create a component or components when used, and to serialize and deserialize itself for persistence within the toolbox database.
An instance of the class can be configured with a name, bitmap, and type to create, without creating a class that derives from . The class also provides a base class for custom toolbox item implementations. A custom can create multiple components. To implement a custom toolbox item, you must derive from and override the CreateComponentsCore, Serialize, and Deserialize methods.
The following properties and methods must be configured for a to function correctly:
The DisplayName property specifies the label for the toolbox item when displayed in a toolbox.
The TypeName property specifies the fully qualified name of the type of the component that the item creates. If a derived class creates multiple components, the TypeName property may or may not be used, contingent on whether a CreateComponentsCore method override depends on the value of this property.
The AssemblyName property specifies the assembly that contains the type of a component that the item creates.
The Bitmap property optionally specifies a bitmap image to display next to the display name for the toolbox item in the toolbox.
The CreateComponentsCore method returns the component instance or instances to insert where this tool is used.
The Locked property indicates whether the properties of the toolbox item can be changed. A toolbox item is typically locked after it is added to a toolbox.
The Lock method locks a toolbox item.
The following code example provides a component that uses the IToolboxService interface to add a text data format handler, or ToolboxItemCreatorCallback, to the toolbox. The data creator callback delegate passes any text data pasted to the toolbox and dragged onto a form to a custom that creates a TextBox containing the text.
The following code example demonstrates the use of the class as a base class for a custom toolbox item implementation.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.