Table of Contents

Class ToolboxControl

Namespace
Alternet.FormDesigner.WinForms
Assembly
Alternet.FormDesigner.v9.dll

Displays and manipulates list of icons for components and controls that user can place onto design surface

[ToolboxBitmap(typeof(FormDesignerControl), "Images.ToolboxControl.Icon.bmp")]
public class ToolboxControl : Panel, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IToolboxControl, IToolboxContentControlSite, ISupportInitialize
Inheritance
ToolboxControl
Implements

Examples

Here is how to declare a ToolboxControl and handle its events from the C# code:

using Alternet.FormDesigner.WinForms;

public partial class Form1 : Form
{
    private void Form1_Load(object sender, EventArgs e)
    {
        var formDesigner = new FormDesignerControl();
        formDesigner.AutoSaveToSource = false;
        formDesigner.Dock = System.Windows.Forms.DockStyle.Left;
        formDesigner.Parent = this;

        var toolboxControl = new ToolboxControl();
        toolboxControl.Parent = this;
        toolboxControl.Dock = System.Windows.Forms.DockStyle.Fill;
        toolboxControl.FormDesignerControl = formDesigner;
        toolboxControl.PlaceItemAtDefaultLocation += ToolboxControl_PlaceItemAtDefaultLocation;
    }

    private void ToolboxControl_PlaceItemAtDefaultLocation(object sender, PlaceToolboxItemAtDefaultLocationEventArgs e)
    {
        if ((e.Item != null) && string.IsNullOrEmpty(e.Item.DisplayName))
        {
            System.Windows.Forms.MessageBox.Show(string.Format("Item: {0} added", e.Item.DisplayName));
        }
    }
}

Here is how to declare a ToolboxControl and handle its events from the Visual Basic code:

Imports System
Imports Alternet.FormDesigner.WinForms

Partial Public Class Form1
    Inherits Form
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim formDesigner = New FormDesignerControl()
        formDesigner.AutoSaveToSource = False
        formDesigner.Dock = Windows.Forms.DockStyle.Left
        formDesigner.Parent = Me

        Dim toolboxControl = New ToolboxControl()
        toolboxControl.Parent = Me
        toolboxControl.Dock = Windows.Forms.DockStyle.Fill
        toolboxControl.FormDesignerControl = formDesigner
        AddHandler toolboxControl.PlaceItemAtDefaultLocation, AddressOf ToolboxControl_PlaceItemAtDefaultLocation
    End Sub

    Private Sub ToolboxControl_PlaceItemAtDefaultLocation(ByVal sender As Object, ByVal e As PlaceToolboxItemAtDefaultLocationEventArgs)
        If e.Item IsNot Nothing AndAlso String.IsNullOrEmpty(e.Item.DisplayName) Then
            Windows.Forms.MessageBox.Show(String.Format("Item: {0} added", e.Item.DisplayName))
        End If
    End Sub
End Class

Constructors

ToolboxControl()

Initializes a new instance of the ToolboxControl class with default settings.

Properties

AutoFillWithStandardItems

Gets or sets a boolean value indicating whether ToolboxControl content should be automatically filled by the standard collection of the toolbox items.

BackColor

Gets or sets the background color for the control.

CategoryNames

Gets collection of Categories (Tabs) displayed by the toolbox.

DesignerHost

Provides an interface for managing designer transactions and components.

FormDesignerControl

Provides an interface to support all standard form editing operations with controls.

HideContentsWhenNoFormDesignerIsSet

Gets or sets a boolean value indicates whether toolbox control should display it's content when FormDesignerControl is not set.

Painter

Provides an interface to draw toolbox item.

SearchControl
SearchEnabled

Gets or sets a value indicating whether toolbox control allows searching components by their names.

SearchFilter

Gets or sets the filter string that determines which controls will be displayed by the ToolboxControl.

SelectedCategory

Gets or sets currently selected toolbox category.

SelectedTool

Returns currently selected toolbox item.

UseMetroIconsForStandardItems

Gets or sets a boolean value indicating whether ToolboxControl should draw standard items using internal icon's collection.

Methods

AddCategory(string)

Adds new category to the toolbox.

AddItem(string, ToolboxItem)

Places toolbox item onto specified toolbox tab.

AddItemForType(string, Type, CustomToolboxImage)

Adds toolbox item from type name.

AddItemForType(string, Type, string, CustomToolboxImage)

Adds toolbox item from type name.

AddItemsFromAssembly(string, Assembly)

Add all types that can appear on the toolbox from the assembly.

ApplySearchEnabled()
BeginInit()

Signals the start of the ToolboxControl initialization.

BeginUpdate()

Prevents repainting of the toolbox until EndUpdate is called.

ClearItemsInCategory(string)

Clears items in the specified tab.

CreateContentControl()
CreateContextMenu()
CreateDefaultPainter()
CreateItemDataObjectForNoDesigner(ToolboxItem)
CreateSearchControl()
CreateSerialization()
Dispose(bool)

Releases the unmanaged resources used by the Control and its child controls and optionally releases the managed resources.

DoesCategoryExist(string)

Identifies whether given category exist in the ToolboxControl.

DoesItemExist(string, ToolboxItem)

Identifies whether given item exist in the specified tab.

DoesItemExist(string, string)

Identifies whether given item exist in the specified tab.

EditCategory(string)

Starts to edit the specified category.

EditItem()

Starts to edit the currently selected item.

EndInit()

Signals the end of the ToolboxControl initialization.

EndUpdate()

Re-enables toolbox repainting.

FillWithStandardItems(bool)

Fills ToolboxControl with standard items.

GetAllTools()

Gets all toolbox items.

GetToolsFromCategory(string)

Gets toolbox items on the specified tab.

InsertCategory(int, string)

Inserts category in the specified position.

InsertItem(int, string, ToolboxItem)

Inserts item in the specified position.

IsCategoryCollapsed(string)

Indicates whether specified category is in the collapsed state.

Load(Stream)

Loads the toolbox content from the specified stream.

MoveCategory(string, int)

Moves category to its current position plus value specified by positionDifference parameter.

MoveItem(string, ToolboxItem, int)

Moves item to its current position plus value specified by positionDifference parameter.

OnMouseUp(MouseEventArgs)

Raises the MouseUp event.

OnVisibleChanged(EventArgs)

Raises the VisibleChanged event.

RemoveAllCategories()

Removes all categories from the toolbox control.

RemoveCategory(string)

Removes specified tab.

RemoveItem(string, ToolboxItem)

Removes toolbox item from the category.

RenameCategory(string, string)

Renames the specified category.

Reset()

Resets the toolbox content to defaults.

Save(Stream)

Saves the toolbox content to the specified stream.

ScrollToCategory(string)

Scrolls toolbox control to the specified category.

ScrollToControl(Control)

Calculates the scroll offset to the specified child control.

ScrollToItem(string, ToolboxItem)

Scrolls toolbox control to the specified item.

SelectPointer()

Deselects currently selected toolbox item and selects pointer tool.

SetCategoryCollapsed(string, bool)

Sets specified collapsed state to the given category.

SetSelectedItem(string, ToolboxItem)

Selects toolbox item.

ShouldSerializeBackColor()

Indicates whether the BackColor property should be persisted.

ShouldSerializeSearchFilter()

Indicates whether the SearchFilter property should be persisted.

ShowContextMenu()

Events

PlaceItemAtDefaultLocation

Event which is fired when user double clicks on a toolbox item.