private void cboGroups_SelectedIndexChanged(object sender, EventArgs e) { ListBarGroup grp = (ListBarGroup)cboGroups.SelectedItem; groupPropertyGrid.SelectedObject = grp; groupPropertyGrid.Update(); }
/// Clean up any resources being used. //protected override void Dispose(bool disposing) //{ // if (disposing) // { // if (components != null) // { // components.Dispose(); // } // } // base.Dispose(disposing); //} private void AddBarItem(ListBarGroup group, ToolboxItem tbi) { ListBarItem lbi = new ListBarItem(tbi.DisplayName); lbi.Image = tbi.Bitmap; group.Items.Add(lbi); lbi.Tag = tbi; }
private void listBar1_GroupClicked(object sender, GroupClickedEventArgs e) { if (e.MouseButton == MouseButtons.Right) { contextGroup = e.Group; groupContextMenu.Show(listBar1, e.Location); } }
private ListBarGroup GetNextGroup(ListBarGroup group) { ListBarGroup nextGroup = null; for (int i = base.Groups.IndexOf(group) + 1; i < base.Groups.Count; i++) { if (base.Groups[i].Visible) { nextGroup = base.Groups[i]; break; } } return(nextGroup); }
/// Resets the selection to the pointer. Note that this is the only method /// which allows our IToolboxService to set our selection. It calls this method /// after a tool has been used. public void SelectPointer() { ListBarGroup list = listBar1.SelectedGroup; deselectAll(); //foreach (ListBarItem lbi in list.Items) //{ // lbi.Selected = false; // //lbi.MouseOver = false; // lbi.MouseDown = false; //} //list.Invalidate(list.GetItemRectangle(selectedIndex)); selectedIndex = 0; //list.SelectedItem = list.Items[0]; list.Items[0].Selected = true; listBar1.Refresh(); //list.Invalidate(list.GetItemRectangle(selectedIndex)); //listBar1.Padding; }
/// <summary> /// Called by the control's internal sizing mechanism. /// Returns the width of a <see cref="ListBarGroup" /> button /// rectangle. /// </summary> /// <param name="group">The <see cref="ListBarGroup"/> to get the size of the /// button for.</param> /// <returns>The width of the button.</returns> protected override int GetGroupButtonWidth(ListBarGroup group) { int ret = base.GetGroupButtonWidth(group); ListBarGroup selectedGroup = base.SelectedGroup; if (group.Equals(selectedGroup)) { ret -= (group.ButtonHeight + 2); } else { ListBarGroup nextGroup = GetNextGroup(selectedGroup); if (nextGroup != null) { if (group.Equals(nextGroup)) { ret -= (group.ButtonHeight + 2); } } } return(ret); }
/// <summary> /// Called by the control's internal sizing mechanism. /// Returns the rectangle for a scroll button. /// </summary> /// <param name="buttonType">The scroll button to /// get the rectangle for.</param> /// <param name="selectedGroup">The Selected Group in the control.</param> /// <param name="internalGroupHeight">The internal height of the /// selected group</param> /// <returns>The Rectangle for the scroll button.</returns> protected override Rectangle GetScrollButtonRectangle( ListBarScrollButton.ListBarScrollButtonType buttonType, ListBarGroup selectedGroup, int internalGroupHeight ) { Point location; Size size = new Size( selectedGroup.ButtonHeight, selectedGroup.ButtonHeight); bool rightToLeft = (base.RightToLeft == RightToLeft.Yes); int left = (rightToLeft ? selectedGroup.ButtonLocation.X - size.Width - 2 : selectedGroup.ButtonLocation.X + selectedGroup.ButtonWidth + 2 ); if (buttonType == ListBarScrollButton.ListBarScrollButtonType.Up) { location = new Point( left, selectedGroup.ButtonLocation.Y); } else { // is selectedGroup the last visible item in the control? ListBarGroup nextGroup = GetNextGroup(selectedGroup); location = new Point( left, (nextGroup == null ? selectedGroup.ButtonLocation.Y + selectedGroup.ButtonHeight + internalGroupHeight - size.Height : nextGroup.ButtonLocation.Y)); } return(new Rectangle(location, size)); }
private void frmTestListBar_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: listBar1.LargeImageList = ilsIconsLarge; listBar1.SmallImageList = ilsIconsSmall; listBar1.ToolTip = toolTips; // Add some items to the ListBar: for (int i = 0; i < 4; i++) { int jMax = 2 + randGen.Next(10); ListBarItem[] subItems = new ListBarItem[jMax]; for (int j = 0; j < jMax; j++) { subItems[j] = new ListBarItem( 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; } } listBar1.Groups.Add( new ListBarGroup(String.Format("Test {0}", i + 1), subItems)); } // Add a bar containing the Tree control: ListBarGroup treeGroup = listBar1.Groups.Add("Tree"); treeGroup.ChildControl = tvwCustom; // Configure ListBar events: listBar1.ItemClicked += listBar1_ItemClicked; listBar1.ItemDoubleClicked += listBar1_ItemDoubleClicked; listBar1.GroupClicked += listBar1_GroupClicked; listBar1.SelectedGroupChanged += listBar1_SelectedGroupChanged; // Configure Menu events: mnuLargeIcons.Click += mnuLargeIcons_Click; mnuSmallIcons.Click += mnuSmallIcons_Click; mnuAddNewGroup.Click += mnuAddNewGroup_Click; mnuRemoveGroup.Click += mnuRemoveGroup_Click; mnuRenameGroup.Click += mnuRenameGroup_Click; mnuListBarShortcut.Click += mnuListBarShortcut_Click; mnuListBarWebShortcut.Click += mnuListBarWebShortcut_Click; mnuContextOpen.Click += mnuContextGeneral_Click; mnuContextAdvancedFind.Click += mnuContextGeneral_Click; mnuContextOpenNew.Click += mnuContextGeneral_Click; mnuContextProperties.Click += mnuContextGeneral_Click; mnuContextSendTo.Click += mnuContextGeneral_Click; mnuContextRemove.Click += mnuContextRemove_Click; mnuContextRename.Click += mnuContextRename_Click; mnuHideOutlookBar.Click += mnuHideOutlookBar_Click; // Check box events: chkStyle.CheckedChanged += chkStyle_CheckedChanged; chkCustomColors.CheckedChanged += chkCustomColors_CheckedChanged; chkBackground.CheckedChanged += chkBackground_CheckedChanged; chkEnabled.CheckedChanged += chkEnabled_CheckedChanged; // Group property editor cboGroups.SelectedIndexChanged += cboGroups_SelectedIndexChanged; pnlProperties.SizeChanged += pnlProperties_SizeChanged; showGroupProperties(); }
private void mnuAddNewGroup_Click(object sender, EventArgs e) { contextGroup = listBar1.Groups.Add(""); listBar1.AfterLabelEdit += listBar1_AfterLabelEdit; contextGroup.StartEdit(); }