Пример #1
0
 ///  <summary>
 ///
 ///       Adds the contents of another <see cref="ToolboxItemCollection"/> to the end of the collection.
 ///
 ///  </summary>
 ///  <param name="value">
 ///    A <see cref="ToolboxItemCollection"/> containing the objects to add to the collection.
 ///  </param>
 ///  <remarks><seealso cref="ToolboxItemCollection.Add"/></remarks>
 ///  <history>
 ///      [dineshc] 3/26/2003  Created
 ///  </history>
 public void AddRange(ToolboxItemCollection value)
 {
     for (int i = 0; (i < value.Count); i = (i + 1))
     {
         this.Add(value[i]);
     }
 }
Пример #2
0
        private void UpdateToolboxItems(int tabIndex)
        {
            Toolbox.ToolsListBox.Items.Clear();
            Toolbox.ToolsListBox.Items.Add(pointer);
            if (Toolbox.Tabs.Count <= 0)
            {
                return;
            }

            ToolboxTab            toolboxTab   = Toolbox.Tabs[tabIndex];
            ToolboxItemCollection toolboxItems = toolboxTab.ToolboxItems;

            foreach (ToolboxItem toolboxItem in toolboxItems)
            {
                Type type = toolboxItem.Type;
                System.Drawing.Design.ToolboxItem     tbi = new System.Drawing.Design.ToolboxItem(type);
                System.Drawing.ToolboxBitmapAttribute tba = TypeDescriptor.GetAttributes(type)[typeof(System.Drawing.ToolboxBitmapAttribute)] as System.Drawing.ToolboxBitmapAttribute;

                DisplayNameAttribute display = (DisplayNameAttribute)Attribute.GetCustomAttribute(type, typeof(DisplayNameAttribute));
                if (display != null)
                {
                    tbi.DisplayName = display.DisplayName;
                }

                if (tba != null)
                {
                    tbi.Bitmap = (System.Drawing.Bitmap)tba.GetImage(type);
                }

                Toolbox.ToolsListBox.Items.Add(tbi);
            }
        }
Пример #3
0
        private void PopulateToolboxItems(XmlNode tabNode, ToolboxTab toolboxTab)
        {
            if (tabNode == null)
            {
                return;
            }

            XmlNode toolboxItemCollectionNode = tabNode[Strings.ToolboxItemCollection];

            if (toolboxItemCollectionNode == null)
            {
                return;
            }

            XmlNodeList toolboxItemNodeList = toolboxItemCollectionNode.ChildNodes;

            if (toolboxItemNodeList == null)
            {
                return;
            }

            ToolboxItemCollection toolboxItems = new ToolboxItemCollection();

            foreach (XmlNode toolboxItemNode in toolboxItemNodeList)
            {
                if (toolboxItemNode == null)
                {
                    continue;
                }

                XmlNode typeNode = toolboxItemNode[Strings.Type];
                if (typeNode == null)
                {
                    continue;
                }

                bool found = false;
                System.Reflection.Assembly[] loadedAssemblies = System.AppDomain.CurrentDomain.GetAssemblies();
                for (int i = 0; i < loadedAssemblies.Length && !found; i++)
                {
                    System.Reflection.Assembly assembly = loadedAssemblies[i];
                    System.Type[] types = assembly.GetTypes();
                    for (int j = 0; j < types.Length && !found; j++)
                    {
                        System.Type type = types[j];
                        if (type.FullName == typeNode.InnerXml.ToString())
                        {
                            ToolboxItem toolboxItem = new ToolboxItem();
                            toolboxItem.Type = type;
                            toolboxItems.Add(toolboxItem);
                            found = true;
                        }
                    }
                }
            }
            toolboxTab.ToolboxItems = toolboxItems;
            return;
        }
Пример #4
0
        public void AddTab(string tabName, Type[] itemTypes)
        {
            ToolboxTab toolboxTab = new ToolboxTab();

            toolboxTab.Name = tabName;

            ToolboxItemCollection toolboxItems = new ToolboxItemCollection();

            for (int i = 0; i < itemTypes.Length; i++)
            {
                ToolboxItem toolboxItem = new ToolboxItem();

                toolboxItem.Type = itemTypes[i];
                toolboxItem.Name = itemTypes[i].Name;
                toolboxItems.Add(toolboxItem);
            }
            toolboxTab.ToolboxItems = toolboxItems;

            m_ToolboxTabCollection.Add(toolboxTab);
        }
Пример #5
0
 ///  <summary>
 ///       Initializes a new instance of <see cref="ToolboxItemCollection"/> based on another <see cref="ToolboxItemCollection"/>.
 ///  </summary>
 ///  <param name="value">
 ///       A <see cref="ToolboxItemCollection"/> from which the contents are copied
 ///  </param>
 ///  <remarks></remarks>
 ///  <history>
 ///      [dineshc] 3/26/2003  Created
 ///  </history>
 public ToolboxItemCollection(ToolboxItemCollection value)
 {
     this.AddRange(value);
 }
Пример #6
0
 public ToolboxItemEnumerator(ToolboxItemCollection mappings)
 {
     this.temp           = ((IEnumerable)(mappings));
     this.baseEnumerator = temp.GetEnumerator();
 }