Export (0) Print
Expand All

IToolboxService Interface

Provides methods and properties to manage and query the toolbox in the development environment.

Namespace:  System.Drawing.Design
Assembly:  System.Drawing (in System.Drawing.dll)

public interface IToolboxService

The IToolboxService interface provides properties and methods for adding and removing toolbox items and toolbox creator callback delegates, serializing and deserializing toolbox items, and retrieving toolbox state information and managing toolbox state.

You can retrieve information about the contents of the toolbox with the following methods:

You can add and remove toolbox items with the following methods:

You can refresh the toolbox, mark a toolbox item as used, or set the mouse cursor to a cursor that represents the current toolbox item using the following methods:

  • The Refresh method refreshes the toolbox display to reflect the current state of the toolbox items.

  • The SelectedToolboxItemUsed method signals the toolbox that the selected toolbox item has been used.

  • The SetCursor method sets the mouse cursor to a cursor that represents the current toolbox item.

You can use the toolbox to serialize or deserialize a toolbox item using the following methods:

The following code example demonstrates the use of the IToolboxService in design mode to list and select toolbox categories and items, and to create components or controls from toolbox items and add them to a Form. To use the example, compile the code to an assembly, and add a reference to the assembly in a Windows Forms application. If you are using Visual Studio, the IToolboxServiceControl is automatically added to the Toolbox. Create an instance of the IToolboxServiceControl on a form to test its behavior.

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

The following code example provides a component that uses the IToolboxService 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 ToolboxItem that creates a TextBox containing the text.

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

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.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft