Category / Section
How to implement a Microsoft Visual Studio.NET toolbox type UI using the WinForms GroupBar and GroupView controls?
1 min read
GroupBar and GroupView
To clone the Microsoft VS.NET toolbox window, the GroupBar and GroupView controls need to be used together in a container (GroupBar) – client (GroupView) relation such that the resulting composite control provides the required UI. The following sequence illustrates the steps involved,
1. Using the steps outlined in Knowledge Base articles, How do I create and initialize a GroupBar control? and How do I create and initialize a GroupView control?, create the GroupBar and GroupView controls.
2. Select the GroupBar control and using the property browser set the following non-default property values:
C#
this.groupBar1.TextAlign = TextAlignment.Left; this.groupBar1.BarHighlight = false; this.groupBar1.GroupBarItemHeight = 18; this.groupBar1.IntegratedScrolling = true;
VB
Me.groupBar1.TextAlign = TextAlignment.Left Me.groupBar1.BarHighlight = False Me.groupBar1.GroupBarItemHeight = 18 Me.groupBar1.IntegratedScrolling = True
3. Select each GroupView control in turn and using the property browser set the following property values:
C#
this.groupView1.SmallImageView = true; this.groupView1.ButtonView = true; this.groupView1.BackColor = SystemColors.Control; this.groupView1.ForeColor = SystemColors.ControlText; this.groupView1.SelectingItemColor = ControlPaint.Light(SystemColors.ControlLight); this.groupView1.SelectedItemColor = ControlPaint.Light(SystemColors.ControlLight); this.groupView1.HighlightImage = true; this.groupView1.HighlightText = true; GroupView1.TextWrap = false; // For List type view this.groupView1.FlowView = false; this.groupView1.ImageSpacing = 2; this.groupView1.ItemXSpacing = 8; this.roupView1.ItemYSpacing = 1; // For Flow type view this.groupView1.FlowView = true; this.groupView1.ImageSpacing = 5; this.groupView1.ItemXSpacing = 0; this.groupView1.ItemYSpacing = 0;
VB
Me.groupView1.SmallImageView = True; Me.groupView1.ButtonView = True; Me.groupView1.BackColor = SystemColors.Control; Me.groupView1.ForeColor = SystemColors.ControlText; Me.groupView1.SelectingItemColor = ControlPaint.Light(SystemColors.ControlLight); Me.groupView1.SelectedItemColor = ControlPaint.Light(SystemColors.ControlLight); Me.groupView1.HighlightImage = True; Me.groupView1.HighlightText = True; GroupView1.TextWrap = False; ' For List type view Me.groupView1.FlowView = False; Me.groupView1.ImageSpacing = 2; Me.groupView1.ItemXSpacing = 8; Me.roupView1.ItemYSpacing = 1; ' For Flow type view Me.groupView1.FlowView = True; Me.groupView1.ImageSpacing = 5; Me.groupView1.ItemXSpacing = 0; Me.groupView1.ItemYSpacing = 0;