Editare

Partajați prin


ToolboxService.CreateItemContainer Method

Definition

Creates a new toolbox item container from a toolbox item or a saved data object.

Overloads

CreateItemContainer(IDataObject)

Creates a new toolbox item container from a saved data object.

CreateItemContainer(ToolboxItem, IDesignerHost)

Creates a new toolbox item container from a toolbox item.

CreateItemContainer(IDataObject)

Creates a new toolbox item container from a saved data object.

protected:
 virtual System::Drawing::Design::ToolboxItemContainer ^ CreateItemContainer(System::Windows::Forms::IDataObject ^ dataObject);
protected virtual System.Drawing.Design.ToolboxItemContainer CreateItemContainer (System.Windows.Forms.IDataObject dataObject);
abstract member CreateItemContainer : System.Windows.Forms.IDataObject -> System.Drawing.Design.ToolboxItemContainer
override this.CreateItemContainer : System.Windows.Forms.IDataObject -> System.Drawing.Design.ToolboxItemContainer
Protected Overridable Function CreateItemContainer (dataObject As IDataObject) As ToolboxItemContainer

Parameters

dataObject
IDataObject

A data object containing saved toolbox data.

Returns

A new toolbox item container.

Exceptions

dataObject is null.

Remarks

The CreateItemContainer method gives you the opportunity to provide a derived version of a ToolboxItemContainer. By default, the ToolboxService class does not support linked items, so it returns null for link parameters that are not null. To provide link support, you should override this method to create a derived ToolboxItemContainer that is capable of handling links.

The data object passed in should contain data obtained from a prior call to the ToolboxItemContainer.ToolboxData property on a toolbox item container.

Notes to Inheritors

A linked toolbox item is one whose existence is tied to the storage of a particular designer host. So, in a typical project system, a designer host is associated with a particular file. A toolbox item linked to a designer host would automatically be deleted from the toolbox when the designer host's source file is deleted or removed from the project.

Linked toolbox items make possible scenarios such as disabling the ASP.NET toolbox items when the Windows Forms designer is open.

Applies to

CreateItemContainer(ToolboxItem, IDesignerHost)

Creates a new toolbox item container from a toolbox item.

protected:
 virtual System::Drawing::Design::ToolboxItemContainer ^ CreateItemContainer(System::Drawing::Design::ToolboxItem ^ item, System::ComponentModel::Design::IDesignerHost ^ link);
protected virtual System.Drawing.Design.ToolboxItemContainer CreateItemContainer (System.Drawing.Design.ToolboxItem item, System.ComponentModel.Design.IDesignerHost link);
abstract member CreateItemContainer : System.Drawing.Design.ToolboxItem * System.ComponentModel.Design.IDesignerHost -> System.Drawing.Design.ToolboxItemContainer
override this.CreateItemContainer : System.Drawing.Design.ToolboxItem * System.ComponentModel.Design.IDesignerHost -> System.Drawing.Design.ToolboxItemContainer
Protected Overridable Function CreateItemContainer (item As ToolboxItem, link As IDesignerHost) As ToolboxItemContainer

Parameters

item
ToolboxItem

The toolbox item for which to create an item container.

link
IDesignerHost

An optional designer host that should be linked to this toolbox item. This parameter can be null.

Returns

A new toolbox item container.

Exceptions

item is null.

Remarks

The CreateItemContainer method gives you the opportunity to provide a derived version of a ToolboxItemContainer. By default, the ToolboxService class does not support linked items, so it returns null for link parameters that are not null. To provide link support, you should override this method to create a derived ToolboxItemContainer that is capable of handling links.

If the provided IDesignerHost link parameter is assigned, it indicates that this is a linked toolbox item.

Notes to Inheritors

A linked toolbox item is one whose existence is tied to the storage of a particular designer host. So, in a typical project system, a designer host is associated with a particular file. A toolbox item linked to a designer host would automatically be deleted from the toolbox when the designer host's source file is deleted or removed from the project.

Linked toolbox items make possible scenarios such as disabling the ASP.NET toolbox items when the Windows Forms designer is open.

See also

Applies to