ToolboxControl Class
Definition
Displays and manipulates list of icons for components and controls that user can place onto design surface
Implements
Syntax
[ToolboxBitmap(typeof(FormDesignerControl), "Images.ToolboxControl.Icon.bmp")]
public class ToolboxControl : Panel, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IToolboxControl, IToolboxContentControlSite, ISupportInitialize
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 |
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 | |
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 |
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 |
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(Boolean) | |
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(Boolean) | Fills ToolboxControl with standard items. |
GetAllTools() | Gets all toolbox items. |
GetToolsFromCategory(String) | Gets toolbox items on the specified tab. |
InsertCategory(Int32, String) | Inserts category in the specified position. |
InsertItem(Int32, 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, Int32) | Moves category to its current position plus value specified by positionDifference parameter. |
MoveItem(String, ToolboxItem, Int32) | Moves item to its current position plus value specified by positionDifference parameter. |
OnMouseUp(MouseEventArgs) | |
OnVisibleChanged(EventArgs) | |
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) | |
ScrollToItem(String, ToolboxItem) | Scrolls toolbox control to the specified item. |
SelectPointer() | Deselects currently selected toolbox item and selects pointer tool. |
SetCategoryCollapsed(String, Boolean) | Sets specified collapsed state to the given category. |
SetSelectedItem(String, ToolboxItem) | Selects toolbox item. |
ShouldSerializeBackColor() | Indicates whether the |
ShouldSerializeSearchFilter() | Indicates whether the |
ShowContextMenu() |
Events
PlaceItemAtDefaultLocation | Event which is fired when user double clicks on a toolbox item. |
Explicit Interface Implementations
IToolboxContentControlSite.CategoryExpandToggleByMouseAllowed | |
IToolboxContentControlSite.OnContentPreferredSizeChanged(Control, Int32) | Adjusts the specified child control into view on an auto-scroll enabled control. |
IToolboxContentControlSite.PlaceItemAtDefaultLocation(ToolboxItem) | Forces designer instance to select the specified item. |
IToolboxContentControlSite.SerializeItemForDragAndDrop(ToolboxItem) | Gets a serializable object for drag and drop operations that represents the specified toolbox item. |
IToolboxContentControlSite.ToolboxControl |