本文整理汇总了C#中System.Drawing.Design.ToolboxItem.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ToolboxItem.ToString方法的具体用法?C# ToolboxItem.ToString怎么用?C# ToolboxItem.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Design.ToolboxItem
的用法示例。
在下文中一共展示了ToolboxItem.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTool
public IComponent[] CreateTool(ToolboxItem tool, Control parent, int x, int y, int width, int height, bool hasLocation, bool hasSize, ToolboxSnapDragDropEventArgs e)
{
IToolboxService service = (IToolboxService) this.GetService(typeof(IToolboxService));
ISelectionService service2 = (ISelectionService) this.GetService(typeof(ISelectionService));
IDesignerHost host = (IDesignerHost) this.GetService(typeof(IDesignerHost));
IComponent[] c = new IComponent[0];
Cursor current = Cursor.Current;
Cursor.Current = Cursors.WaitCursor;
DesignerTransaction transaction = null;
try
{
try
{
if (host != null)
{
transaction = host.CreateTransaction(System.Design.SR.GetString("DesignerBatchCreateTool", new object[] { tool.ToString() }));
}
}
catch (CheckoutException exception)
{
if (exception != CheckoutException.Canceled)
{
throw exception;
}
return c;
}
try
{
try
{
if ((host != null) && this.CurrentlyLocalizing(host.RootComponent))
{
IUIService service3 = (IUIService) this.GetService(typeof(IUIService));
if (service3 != null)
{
service3.ShowMessage(System.Design.SR.GetString("LocalizingCannotAdd"));
}
return new IComponent[0];
}
Hashtable defaultValues = new Hashtable();
if (parent != null)
{
defaultValues["Parent"] = parent;
}
if ((parent != null) && parent.IsMirrored)
{
x += width;
}
if (hasLocation)
{
defaultValues["Location"] = new Point(x, y);
}
if (hasSize)
{
defaultValues["Size"] = new Size(width, height);
}
if (e != null)
{
defaultValues["ToolboxSnapDragDropEventArgs"] = e;
}
c = tool.CreateComponents(host, defaultValues);
}
catch (CheckoutException exception2)
{
if (exception2 != CheckoutException.Canceled)
{
throw;
}
c = new IComponent[0];
}
catch (ArgumentException exception3)
{
IUIService service4 = (IUIService) this.GetService(typeof(IUIService));
if (service4 != null)
{
service4.ShowError(exception3);
}
}
catch (Exception exception4)
{
IUIService service5 = (IUIService) this.GetService(typeof(IUIService));
string message = string.Empty;
if (exception4.InnerException != null)
{
message = exception4.InnerException.ToString();
}
if (string.IsNullOrEmpty(message))
{
message = exception4.ToString();
}
if (exception4 is InvalidOperationException)
{
message = exception4.Message;
}
if (service5 == null)
{
throw;
}
service5.ShowError(exception4, System.Design.SR.GetString("FailedToCreateComponent", new object[] { tool.DisplayName, message }));
}
//.........这里部分代码省略.........