本文整理汇总了C#中System.Drawing.Design.ToolboxItem类的典型用法代码示例。如果您正苦于以下问题:C# ToolboxItem类的具体用法?C# ToolboxItem怎么用?C# ToolboxItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ToolboxItem类属于System.Drawing.Design命名空间,在下文中一共展示了ToolboxItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SideTabItemDesigner
///<summary>create a tabitem from a toolboxitem. It init Icon from the tag</summary>
public SideTabItemDesigner(string name, ToolboxItem tag)
: base(name, tag)
{
CanBeRenamed = false;
this.Icon = tag.Bitmap;
ReloadToolBox();
}
示例2: CreateToolCore
protected override IComponent[] CreateToolCore(ToolboxItem tool, int x, int y, int width, int height, bool hasLocation, bool hasSize)
{
if (tool != null)
{
System.Type c = tool.GetType(this.designerHost);
if (!typeof(ToolStrip).IsAssignableFrom(c))
{
ToolStripContainer parent = this.panel.Parent as ToolStripContainer;
if (parent != null)
{
ToolStripContentPanel contentPanel = parent.ContentPanel;
if (contentPanel != null)
{
PanelDesigner toInvoke = this.designerHost.GetDesigner(contentPanel) as PanelDesigner;
if (toInvoke != null)
{
ParentControlDesigner.InvokeCreateTool(toInvoke, tool);
}
}
}
}
else
{
base.CreateToolCore(tool, x, y, width, height, hasLocation, hasSize);
}
}
return null;
}
示例3: GetCachedToolboxItem
private static ToolboxItem GetCachedToolboxItem(System.Type itemType)
{
ToolboxItem toolboxItem = null;
if (CachedToolboxItems == null)
{
CachedToolboxItems = new Dictionary<System.Type, ToolboxItem>();
}
else if (CachedToolboxItems.ContainsKey(itemType))
{
return CachedToolboxItems[itemType];
}
if (toolboxItem == null)
{
toolboxItem = ToolboxService.GetToolboxItem(itemType);
if (toolboxItem == null)
{
toolboxItem = new ToolboxItem(itemType);
}
}
CachedToolboxItems[itemType] = toolboxItem;
if ((CustomToolStripItemCount > 0) && ((CustomToolStripItemCount * 2) < CachedToolboxItems.Count))
{
CachedToolboxItems.Clear();
}
return toolboxItem;
}
示例4: GetToolboxItemList
public List<ToolboxItem> GetToolboxItemList()
{
List<dynamic> itemMetadataList = new List<dynamic>
{
new { DisplayName = "Place", Bitmap = Resources.Place, CommandName = "Place" },
new { DisplayName = "Transition", Bitmap = Resources.Transition, CommandName = "Transition" },
new { DisplayName = "AND-split", Bitmap = Resources.AndSplit, CommandName = "AndSplit" },
new { DisplayName = "OR-split", Bitmap = Resources.OrSplit, CommandName = "OrSplit" },
new { DisplayName = "AND-join", Bitmap = Resources.AndJoin, CommandName = "AndJoin" },
new { DisplayName = "OR-join", Bitmap = Resources.OrJoin, CommandName = "OrJoin" },
new { DisplayName = "Subprocess", Bitmap = Resources.Subprocess, CommandName = "Subprocess" },
};
List<ToolboxItem> result = new List<ToolboxItem>();
foreach (dynamic metadata in itemMetadataList)
{
ToolboxItem toolboxItem = new ToolboxItem();
toolboxItem.Properties.Add(
ItemCommandNameProperty,
new PetriNetEditorToolboxItemData
{
CommandName = metadata.CommandName
});
toolboxItem.DisplayName = metadata.DisplayName;
toolboxItem.Bitmap = metadata.Bitmap;
result.Add(toolboxItem);
}
return result;
}
示例5: CreateReportingSidetab
private static SideTab CreateReportingSidetab ()
{
SideTab sideTab = new SideTab("ReportDesigner");
sideTab.CanSaved = false;
AddPointerToSideTab(sideTab);
// TextItem
ToolboxItem tb = new ToolboxItem(typeof(ICSharpCode.Reports.Addin.BaseTextItem));
tb.DisplayName = ResourceService.GetString("SharpReport.Toolbar.TextBox");
tb.Bitmap = WinFormsResourceService.GetIcon("Icons.16.16.SharpReport.Textbox").ToBitmap();
sideTab.Items.Add(new SideTabItemDesigner(tb));
// Row
tb = new ToolboxItem(typeof(ICSharpCode.Reports.Addin.BaseRowItem));
tb.Bitmap = WinFormsResourceService.GetBitmap("Icons.16x16.SharpQuery.Table");
tb.DisplayName = ResourceService.GetString("SharpReport.Toolbar.DataRow");
sideTab.Items.Add(new SideTabItemDesigner(tb));
//BaseTable
tb.Bitmap = WinFormsResourceService.GetBitmap("Icons.16x16.SharpQuery.Table");
tb = new ToolboxItem(typeof(ICSharpCode.Reports.Addin.BaseTableItem));
tb.DisplayName ="Table";
sideTab.Items.Add(new SideTabItemDesigner(tb));
tb.Bitmap = WinFormsResourceService.GetBitmap("Icons.16x16.SharpQuery.Table");
//BaseDataItem
tb = new ToolboxItem(typeof(ICSharpCode.Reports.Addin.BaseDataItem));
tb.DisplayName = ResourceService.GetString("SharpReport.Toolbar.DataField");
sideTab.Items.Add(new SideTabItemDesigner(tb));
//Grahics
// Line
tb = new ToolboxItem(typeof(ICSharpCode.Reports.Addin.BaseLineItem));
tb.DisplayName = ResourceService.GetString("SharpReport.Toolbar.Line");
tb.Bitmap = WinFormsResourceService.GetIcon("Icons.16.16.SharpReport.Line").ToBitmap();
sideTab.Items.Add(new SideTabItemDesigner(tb));
// Rectangle
tb = new ToolboxItem(typeof(ICSharpCode.Reports.Addin.BaseRectangleItem));
tb.DisplayName = ResourceService.GetString("SharpReport.Toolbar.Rectangle");
tb.Bitmap = GlobalValues.RectangleBitmap();
sideTab.Items.Add(new SideTabItemDesigner(tb));
// Circle
tb = new ToolboxItem(typeof(ICSharpCode.Reports.Addin.BaseCircleItem));
tb.DisplayName = ResourceService.GetString("SharpReport.Toolbar.Circle");
tb.Bitmap = GlobalValues.CircleBitmap();
sideTab.Items.Add(new SideTabItemDesigner(tb));
// Image
tb = new ToolboxItem(typeof(ICSharpCode.Reports.Addin.BaseImageItem));
tb.DisplayName = ResourceService.GetString("SharpReport.Toolbar.Image");
tb.Bitmap = WinFormsResourceService.GetIcon("Icons.16x16.ResourceEditor.bmp").ToBitmap();
sideTab.Items.Add(new SideTabItemDesigner(tb));
return sideTab;
}
示例6: CreateToolCore
protected virtual IComponent[] CreateToolCore(ToolboxItem tool,
int x, int y, int width, int height,
bool hasLocation, bool hasSize)
{
// TODO
return null;
}
示例7: AddToolboxItem
public void AddToolboxItem (ToolboxItem toolboxItem, string category)
{
if (!categories.ContainsKey (category))
categories[category] = new ArrayList ();
System.Diagnostics.Trace.WriteLine ("Adding ToolboxItem: " + toolboxItem.DisplayName + ", " + category);
((ArrayList) categories[category]).Add (toolboxItem);
}
示例8: SetSelectedToolboxItem
public override void SetSelectedToolboxItem(ToolboxItem toolboxItem)
{
if (toolboxItem == null)
base.SetSelectedToolboxItem(FindToolBoxItem(x => x.DisplayName == "Pointer"));
else
base.SetSelectedToolboxItem(toolboxItem);
}
示例9: ToolboxPane
public ToolboxPane()
{
this.InitializeComponent();
this.pointer = new ToolboxItem();
this.pointer.DisplayName = "<Zeiger>";
this.pointer.Bitmap = new Bitmap(0x10, 0x10);
this.FillToolbox();
ListBox list = this.listWindowsForms;
}
示例10: SideTabItemDesigner
///<summary>create a tabitem from a toolboxitem. It init Icon and name from the tag</summary>
public SideTabItemDesigner(ToolboxItem tag) : base(tag.DisplayName, tag)
{
if (tag == null) {
throw new ArgumentNullException("tag");
}
CanBeRenamed = false;
this.Icon = tag.Bitmap;
ReloadToolBox();
}
示例11: CreateToolCore
protected override IComponent[] CreateToolCore(ToolboxItem tool, int x, int y, int width, int height, bool hasLocation, bool hasSize)
{
if (this.Selected == null)
{
this.Selected = this.splitterPanel1;
}
SplitterPanelDesigner toInvoke = (SplitterPanelDesigner) this.designerHost.GetDesigner(this.Selected);
ParentControlDesigner.InvokeCreateTool(toInvoke, tool);
return null;
}
示例12: ToolCursor
/// <summary>
/// Initializes a new instance of the <see cref="ToolCursor"/> class.
/// </summary>
/// <param name="item">A <see cref="ToolboxItem"/> object.</param>
public ToolCursor(ToolboxItem item)
{
this._item = item;
if (item.Bitmap != null) {
using (Bitmap bitmap = this.CreateCursor(item.Bitmap)) {
this._hIcon = bitmap.GetHicon();
this._cursor = new Cursor(this._hIcon);
}
}
}
示例13: ToolboxItemToolboxNode
public ToolboxItemToolboxNode(ToolboxItem item)
{
this.item = item;
base.Name = item.DisplayName;
if (item.Bitmap != null)
base.Icon = base.ImageToPixbuf (item.Bitmap);
if (item.AssemblyName != null)
foreach (System.ComponentModel.CategoryAttribute ca in
System.Reflection.Assembly.Load (item.AssemblyName)
.GetType (item.TypeName)
.GetCustomAttributes (typeof (System.ComponentModel.CategoryAttribute), true))
this.Category = ca.Category;
}
示例14: CreateToolCore
protected override IComponent[] CreateToolCore(ToolboxItem tool, int x, int y, int width, int height, bool hasLocation, bool hasSize)
{
TabControl control = (TabControl) this.Control;
if (control.SelectedTab == null)
{
throw new ArgumentException(System.Design.SR.GetString("TabControlInvalidTabPageType", new object[] { tool.DisplayName }));
}
IDesignerHost service = (IDesignerHost) this.GetService(typeof(IDesignerHost));
if (service != null)
{
TabPageDesigner toInvoke = (TabPageDesigner) service.GetDesigner(control.SelectedTab);
ParentControlDesigner.InvokeCreateTool(toInvoke, tool);
}
return null;
}
示例15: ToolBoxListItem
public ToolBoxListItem(ToolboxItem toolBoxItem)
{
Size = new Size (150, 20);
SetStyle (ControlStyles.ResizeRedraw, true);
Text = toolBoxItem.DisplayName;
if (toolBoxItem.Bitmap != null)
image = toolBoxItem.Bitmap;
else
image = SystemIcons.Exclamation.ToBitmap ();
tool_box_item = toolBoxItem;
}