/// <summary> /// 添加一个工具盒分组 /// </summary> /// <param name="name"></param> public void AddToolBoxTab(string name) { if (_toolboxTabCollection[name] != null) { return; } ToolboxTab toolboxTab = new ToolboxTab(); toolboxTab.Name = name; toolboxTab.ToolboxItems = new ToolboxItemCollection(); // PopulateToolboxItems(toolboxTab); this._toolboxTabCollection.Add(toolboxTab); }
public ToolboxTab this[string name] { get { foreach (object obj in List) { ToolboxTab tab = obj as ToolboxTab; if (tab.Name == name) { return(tab); } } return(null); } }
//public ToolboxTabCollection PopulateToolboxInfo() //{ // try // { // if (Toolbox.FilePath == null || Toolbox.FilePath == "" || Toolbox.FilePath == String.Empty) // return PopulateToolboxTabs(); // XmlDocument xmlDocument = new XmlDocument(); // xmlDocument.Load(Toolbox.FilePath); // return PopulateToolboxTabs(xmlDocument); // } // catch (Exception ex) // { // MessageBox.Show("Error occured in reading Toolbox.xml file.\n" + ex.ToString()); // return null; // } //} //private Toolbox Toolbox //{ // get // { // return m_toolbox; // } //} public ToolboxTabCollection PopulateToolboxTabs() { ToolboxTabCollection toolboxTabs = new ToolboxTabCollection(); string[] tabNames = { Strings.WindowsForms, Strings.Components, Strings.Data, Strings.UserControls }; for (int i = 0; i < tabNames.Length; i++) { ToolboxTab toolboxTab = new ToolboxTab(); toolboxTab.Name = tabNames[i]; PopulateToolboxItems(toolboxTab); toolboxTabs.Add(toolboxTab); } return(toolboxTabs); }
private void PopulateToolboxItems(ToolboxTab toolboxTab) { if (toolboxTab == null) { return; } Type[] typeArray = null; switch (toolboxTab.Name) { case Strings.WindowsForms: typeArray = windowsFormsToolTypes; break; case Strings.Components: typeArray = componentsToolTypes; break; case Strings.Data: typeArray = dataToolTypes; break; case Strings.UserControls: typeArray = userControlsToolTypes; break; default: break; } ToolboxItemCollection toolboxItems = new ToolboxItemCollection(); for (int i = 0; i < typeArray.Length; i++) { ToolboxItem toolboxItem = new ToolboxItem(); toolboxItem.Type = typeArray[i]; toolboxItem.Name = typeArray[i].Name; toolboxItems.Add(toolboxItem); } toolboxTab.ToolboxItems = toolboxItems; }
/// <summary> /// Removes a specific <see cref="ToolboxLibrary.ToolboxTab"/> from the /// <see cref="ToolboxLibrary.ToolboxTabCollection"/> . /// </summary> /// <param name="value">The <see cref="ToolboxLibrary.ToolboxTab"/> to remove from the <see cref="ToolboxLibrary.ToolboxTabCollection"/> .</param> /// <remarks><exception cref="System.ArgumentException"><paramref name="value"/> is not found in the Collection. </exception></remarks> /// <history> /// [dineshc] 3/26/2003 Created /// </history> public void Remove(ToolboxTab value) { List.Remove(value); }
/// <summary> /// Inserts a <see cref="ToolboxLibrary.ToolboxTab"/> into the <see cref="ToolboxLibrary.ToolboxTabCollection"/> at the specified index. /// </summary> /// <param name="index">The zero-based index where <paramref name="value"/> should be inserted.</param> /// <param name=" value">The <see cref="ToolboxLibrary.ToolboxTab"/> to insert.</param> /// <remarks><seealso cref="ToolboxLibrary.ToolboxTabCollection.Add"/></remarks> /// <history> /// [dineshc] 3/26/2003 Created /// </history> public void Insert(int index, ToolboxTab value) { List.Insert(index, value); }
/// <summary> /// Returns the index of a <see cref="ToolboxLibrary.ToolboxTab"/> in /// the <see cref="ToolboxLibrary.ToolboxTabCollection"/> . /// </summary> /// <param name="value">The <see cref="ToolboxLibrary.ToolboxTab"/> to locate.</param> /// <returns> /// The index of the <see cref="ToolboxLibrary.ToolboxTab"/> of <paramref name="value"/> in the /// <see cref="ToolboxLibrary.ToolboxTabCollection"/>, if found; otherwise, -1. /// </returns> /// <remarks><seealso cref="ToolboxLibrary.ToolboxTabCollection.Contains"/></remarks> /// <history> /// [dineshc] 3/26/2003 Created /// </history> public int IndexOf(ToolboxTab value) { return(List.IndexOf(value)); }
/// <summary> /// Gets a value indicating whether the /// <see cref="ToolboxLibrary.ToolboxTabCollection"/> contains the specified <see cref="ToolboxLibrary.ToolboxTab"/>. /// </summary> /// <param name="value">The <see cref="ToolboxLibrary.ToolboxTab"/> to locate.</param> /// <returns> /// <see langword="true"/> if the <see cref="ToolboxLibrary.ToolboxTab"/> is contained in the collection; /// otherwise, <see langword="false"/>. /// </returns> /// <remarks><seealso cref="ToolboxLibrary.ToolboxTabCollection.IndexOf"/></remarks> /// <history> /// [dineshc] 3/26/2003 Created /// </history> public bool Contains(ToolboxTab value) { return(List.Contains(value)); }
/// <summary> /// Adds a <see cref="ToolboxLibrary.ToolboxTab"/> with the specified value to the /// <see cref="ToolboxLibrary.ToolboxTabCollection"/> . /// </summary> /// <param name="value">The <see cref="ToolboxLibrary.ToolboxTab"/> to add.</param> /// <returns> /// The index at which the new element was inserted. /// </returns> /// <remarks><seealso cref="ToolboxLibrary.ToolboxTabCollection.AddRange"/></remarks> /// <history> /// [dineshc] 3/26/2003 Created /// </history> public int Add(ToolboxTab value) { return(List.Add(value)); }