Esempio n. 1
0
 private void LoadToolboxItems(ToolBoxList toolbox, References references)
 {
     toolbox.SuspendLayout();
     foreach (Type type in containers)
     {
         ToolboxItem tool = new ToolboxItem(type);
         toolbox.AddToolboxItem(tool, "Containers");
     }
     foreach (Type type in commonControls)
     {
         ToolboxItem tool = new ToolboxItem(type);
         toolbox.AddToolboxItem(tool, "Common Controls");
     }
     foreach (Type type in menusToolbars)
     {
         ToolboxItem tool = new ToolboxItem(type);
         toolbox.AddToolboxItem(tool, "Menus and Toolbars");
     }
     foreach (Type type in commonComponents)
     {
         ToolboxItem tool = new ToolboxItem(type);
         toolbox.AddToolboxItem(tool, "Common Components");
     }
     foreach (Assembly assembly in references.Assemblies)
     {
         LoadAssemblyToolboxItems(toolbox, assembly);
     }
     toolbox.ResumeLayout();
 }
Esempio n. 2
0
 private void LoadAssemblyToolboxItems(ToolBoxList toolbox, Assembly assembly)
 {
     _toolbox.SuspendLayout();
     foreach (Type type in assembly.GetTypes())
     {
         if (IsValidToolType(type) && HasEmptyPublicCtor(type))
         {
             ToolboxItem tool = new ToolboxItem(type);
             // If the assembly is not in the GAC assume
             // an assembly with custom controls
             //
             if (assembly.GlobalAssemblyCache)
             {
                 toolbox.AddToolboxItem(tool, "All");
             }
             else
             {
                 toolbox.AddToolboxItem(tool, "Custom Components");
             }
         }
     }
     _toolbox.ResumeLayout();
 }