private void toolboxButton_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { ToolboxItemButton toolboxItemButton = sender as ToolboxItemButton; this._selectedToolboxItemButton = toolboxItemButton; this.Toolbox.SelectedToolboxItem = toolboxItemButton.ToolboxItem; if (toolboxItemButton.ToolboxItem.TypeName != String.Empty) { this.Toolbox.ToolBoxItemButtonMouseDown(e, toolboxItemButton.ToolboxItem); } }
private void DrawToolBoxItem(System.Drawing.Design.ToolboxItem toolboxItem, string displayName) { if (displayName == String.Empty) { displayName = toolboxItem.DisplayName; } ToolboxItemButton toolboxButton = new ToolboxItemButton(toolboxItem, displayName); toolboxButton.Index = this.toolboxItemButtonCollection.Count; toolboxButton.Height = this.ItemHeight; toolboxButton.Dock = DockStyle.Top; this.toolTip.SetToolTip(toolboxButton, toolboxItem.Description); toolboxButton.MouseDown += new MouseEventHandler(toolboxButton_MouseDown); toolboxButton.KeyUp += new KeyEventHandler(toolboxButton_KeyUp); this.toolboxItemButtonCollection.Add(toolboxButton); this.Controls.Add(toolboxButton); }