Ejemplo n.º 1
0
        /// <summary>
        /// Adds a new group with the specified caption and returns a reference
        /// to it.
        /// </summary>
        /// <param name="caption">The caption for the group to create.</param>
        /// <returns>The newly created <see cref="VSNetListBarGroup"/></returns>
        public new virtual VSNetListBarGroup Add(string caption)
        {
            VSNetListBarGroup newGroup = new VSNetListBarGroup(caption);

            Add(newGroup);
            return(newGroup);
        }
        private void cboGroups_SelectedIndexChanged(object sender, EventArgs e)
        {
            VSNetListBarGroup grp = (VSNetListBarGroup)cboGroups.SelectedItem;

            groupPropertyGrid.SelectedObject = grp;
            groupPropertyGrid.Update();
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds a range of new groups with the specified captions to the collection.
 /// </summary>
 /// <param name="captions">Array of captions for the new groups to create.</param>
 public override void AddRange(string[] captions)
 {
     foreach (string caption in captions)
     {
         VSNetListBarGroup newGroup = new VSNetListBarGroup(caption);
         Add(newGroup);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Draws the button onto the specified Graphics object.
        /// </summary>
        /// <param name="gfx">The graphics object to draw on.</param>
        /// <param name="defaultBackColor">The default background
        /// colour to use when drawing the button.</param>
        /// <param name="controlEnabled">Whether the control is enabled or not.</param>
        public override void DrawItem(
            Graphics gfx,
            Color defaultBackColor,
            bool controlEnabled
            )
        {
            Color backColor = defaultBackColor;

            if (owner != null)
            {
                VSNetListBarGroup selGroup = owner.SelectedGroup;
                if (selGroup != null)
                {
                    if (ButtonType == ListBarScrollButtonType.Up)
                    {
                        backColor = selGroup.BackColor;
                    }
                    else
                    {
                        VSNetListBarGroup nextGroup = null;
                        for (int i = owner.Groups.IndexOf(selGroup) + 1; i < owner.Groups.Count; i++)
                        {
                            if (owner.Groups[i].Visible)
                            {
                                nextGroup = owner.Groups[i];
                                break;
                            }
                        }
                        if (nextGroup != null)
                        {
                            backColor = nextGroup.BackColor;
                        }
                    }
                }
            }
            Brush br = new SolidBrush(backColor);

            gfx.FillRectangle(br, Rectangle);
            br.Dispose();
            // in VS.NET bar the item is always drawn.  When
            // it's not "Visible" then it is drawn disabled:
            VSNetListBarUtility.DrawScrollButton(
                gfx, Rectangle, backColor,
                (MouseDown && MouseOver),
                (Visible && controlEnabled),
                (ButtonType != ListBarScrollButtonType.Up));
        }
        private void frmVsNetListBarTest_Load(object sender, EventArgs e)
        {
            Random randGen = new Random();

            // Add some items to the TreeView:
            tvwCustom.ImageList     = ilsIconsSmall;
            tvwCustom.ShowLines     = true;
            tvwCustom.ShowPlusMinus = true;
            TreeNode[] childNodes = new TreeNode[10];
            for (int i = 0; i < 10; i++)
            {
                int iconIndex = randGen.Next(ilsIconsSmall.Images.Count);
                childNodes[i] = new TreeNode(
                    String.Format("TreeItem {0}", i),
                    iconIndex, iconIndex);
            }
            TreeNode nodTop = new TreeNode("Connections", 0, 0, childNodes);

            tvwCustom.Nodes.Add(nodTop);
            nodTop.Expand();

            // Add some items to the ListBar:
            vsNetListBar1.LargeImageList = ilsIconsLarge;
            vsNetListBar1.SmallImageList = ilsIconsSmall;
            vsNetListBar1.ToolTip        = toolTips;

            // Add some items to the ListBar:
            for (int i = 0; i < 4; i++)
            {
                int jMax = 2 + randGen.Next(10);
                VSNetListBarItem[] subItems = new VSNetListBarItem[jMax];
                for (int j = 0; j < jMax; j++)
                {
                    subItems[j] = new VSNetListBarItem(
                        String.Format("Test Item {0} in Bar {1}", j + 1, i + 1),
                        j % 4,
                        String.Format("Tooltip text for test item {0}", j + 1));
                    if (j == 2)
                    {
                        subItems[j].Enabled = false;
                    }
                }
                vsNetListBar1.Groups.Add(
                    new VSNetListBarGroup(String.Format("Test {0}", i + 1),
                                          subItems));
            }
            // Add a bar containing the Tree control:
            VSNetListBarGroup treeGroup = vsNetListBar1.Groups.Add("Tree");

            treeGroup.ChildControl = tvwCustom;

            // Configure ListBar events:
            vsNetListBar1.ItemClicked          += listBar1_ItemClicked;
            vsNetListBar1.ItemDoubleClicked    += listBar1_ItemDoubleClicked;
            vsNetListBar1.GroupClicked         += listBar1_GroupClicked;
            vsNetListBar1.SelectedGroupChanged += listBar1_SelectedGroupChanged;

            // Group property editor
            cboGroups.SelectedIndexChanged += cboGroups_SelectedIndexChanged;
            pnlProperties.SizeChanged      += pnlProperties_SizeChanged;

            showGroupProperties();
        }
Ejemplo n.º 6
0
 public virtual void Remove(VSNetListBarGroup group)
 {
     InnerList.Remove(group);
     NotifyOwner(group, true);
 }
Ejemplo n.º 7
0
 public virtual void InsertAfter(VSNetListBarGroup groupAfter, VSNetListBarGroup group)
 {
     base.InsertAfter(groupAfter, group);
 }
Ejemplo n.º 8
0
 public virtual void InsertBefore(VSNetListBarGroup groupBefore, VSNetListBarGroup group)
 {
     base.InsertBefore(groupBefore, group);
 }
Ejemplo n.º 9
0
 public virtual void Insert(int index, VSNetListBarGroup group)
 {
     base.Insert(index, group);
 }
Ejemplo n.º 10
0
 public virtual int IndexOf(VSNetListBarGroup group)
 {
     return(base.IndexOf(group));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Determines whether a <see cref="ListBarGroup"/> element is contained within
 /// the control's collection of groups.
 /// </summary>
 /// <param name="group">The ListBarGroup to check if present.</param>
 /// <returns>True if the ListBarGroup is contained within the control's
 /// collection, False otherwise.</returns>
 public virtual bool Contains(VSNetListBarGroup group)
 {
     return(base.Contains(group));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Adds a new group to the control.
 /// </summary>
 /// <param name="group">The <see cref="VSNetListBarGroup"/> to add.</param>
 /// <returns>The 0-based index of the added group.</returns>
 public virtual int Add(VSNetListBarGroup group)
 {
     return(base.Add(group));
 }