当前位置: 首页>>代码示例>>C#>>正文


C# ToolboxItem.ToString方法代码示例

本文整理汇总了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 }));
             }
//.........这里部分代码省略.........
开发者ID:Reegenerator,项目名称:Sample-CustomizeDatasetCS,代码行数:101,代码来源:OleDragDropHandler.cs


注:本文中的System.Drawing.Design.ToolboxItem.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。