See Also: ToolboxItem Members
System.Drawing.Design.ToolboxItem 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 System.Drawing.Design.ToolboxItem 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 System.Drawing.Design.ToolboxItem class can be configured with a name, bitmap, and type to create, without creating a class that derives from System.Drawing.Design.ToolboxItem. The System.Drawing.Design.ToolboxItem class also provides a base class for custom toolbox item implementations. A custom System.Drawing.Design.ToolboxItem can create multiple components. To implement a custom toolbox item, you must derive from System.Drawing.Design.ToolboxItem and override the ToolboxItem.CreateComponentsCore(System.ComponentModel.Design.IDesignerHost), ToolboxItem.Serialize(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext), and ToolboxItem.Deserialize(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) methods.
The following properties and methods must be configured for a System.Drawing.Design.ToolboxItem to function correctly:
The ToolboxItem.DisplayName property specifies the label for the toolbox item when displayed in a toolbox.
The ToolboxItem.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 ToolboxItem.TypeName property may or may not be used, contingent on whether a ToolboxItem.CreateComponentsCore(System.ComponentModel.Design.IDesignerHost) method override depends on the value of this property.
The ToolboxItem.AssemblyName property specifies the assembly that contains the type of a component that the item creates.
The ToolboxItem.Bitmap property optionally specifies a bitmap image to display next to the display name for the toolbox item in the toolbox.
The ToolboxItem.Filter property optionally contains any System.ComponentModel.ToolboxItemFilterAttribute objects that determine whether the toolbox item can be used on a particular component.
The ToolboxItem.CreateComponentsCore(System.ComponentModel.Design.IDesignerHost) method returns the component instance or instances to insert where this tool is used.
The ToolboxItem.Serialize(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) method saves the toolbox item to a specified System.Runtime.Serialization.SerializationInfo.
The ToolboxItem.Deserialize(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) method configures the toolbox item from the state information contained in the specified System.Runtime.Serialization.SerializationInfo.
The ToolboxItem.Initialize(Type) method configures the toolbox item to create the specified type of component, if the ToolboxItem.CreateComponentsCore(System.ComponentModel.Design.IDesignerHost) method has not been overridden to behave differently.
The ToolboxItem.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 ToolboxItem.Lock method locks a toolbox item.
The ToolboxItem.CheckUnlocked method throws an exception if the ToolboxItem.Locked property is true.