|
||
|
VS.NET ListBar ControlThis control uses the Outlook Style ListBar control as a basis for a full implementation of a Visual Studio-style List Bar which holds lists of controls. Bars and items can be dragged around the control, and items can be dragged, pressed or double-clicked to add the item to an object. For additional flexibility, you can also add controls to the bars. Using The ControlBefore you run this control, you will need the binary for the Outlook Style ListBar (acclListBar.dll) as this control is derived by extension from that control. You can also download the documentation for the control since this control has exactly the same set of properties and methods, the only difference being that the name of every object is prefixed with "VSNet". Next, add a reference to acclListBar.dll and acclVSNetListBar.dll. Note both of these objects are signed with strong names so can be registered in the GAC. You can now add acclVSNetListBar.dll to the toolbox and create an instance of the control on your form. This code gives a quick flavour of how you add groups and items to the control: // Set the image lists: vsNetListBar1.LargeImageList = ilsIconsLarge; vsNetListBar1.SmallImageList = ilsIconsSmall; // Set the tooltip object (optional) vsNetListBar1.ToolTip = toolTips; // Create 4 bars and add a random number of items to each: for (int i = 0; i < 4; i++) { // Create the items: 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; } } // Create the group and add the sub items: vsNetListBar1.Groups.Add( new VSNetListBarGroup(String.Format("Test {0}", i + 1), subItems)); } // Add a bar containing a TreeView control: VSNetListBarGroup treeGroup = vsNetListBar1.Groups.Add("Tree"); treeGroup.ChildControl = tvwCustom; // Configure ListBar events: this.vsNetListBar1.ItemClicked += new ItemClickedEventHandler(listBar1_ItemClicked); this.vsNetListBar1.ItemDoubleClicked += new ItemClickedEventHandler(listBar1_ItemDoubleClicked); this.vsNetListBar1.GroupClicked += new GroupClickedEventHandler(listBar1_GroupClicked); this.vsNetListBar1.SelectedGroupChanged += new EventHandler(listBar1_SelectedGroupChanged);} OmissionsThere are two omissions in this implementation:
Both of these issues should be corrected in the next update.
|
|
|