ComponentOne List for WinForms
In This Topic
    Vertical Scrolling and Split Groups
    In This Topic

    By default, the list has only one horizontal split, with split index 0, and its HScrollBar and VScrollBar style properties are set to ScrollBarStyleEnum.Automatic. That is, the horizontal or vertical scroll bar will appear as necessary depending upon the column widths and the number of data rows available. The default split's HorizontalScrollGroup and VerticalScrollGroup properties are set to 1. Splits having the same scrollgroup property setting will scroll vertically or horizontally together. When a new split is created, it will inherit both the state of the scroll bars and the Scroll Group properties from the parent split. If all of the splits belonging to the same HorizontalScrollGroup or VerticalScrollGroup have their HScrollBar and VScrollBar style properties set to Automatic, then C1List will display the vertical scroll bar or horizontal scroll bar only at the rightmost or bottomost split of the scroll group. Manipulating this single scroll bar will cause all splits in the same scroll group to scroll simultaneously.

    For example, if you create two additional splits with the following code:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    'Create a Split on the left.
    Me.C1List1.InsertHorizontalSplit(0)  
    ' Create another Split on the left.
    Me.C1List1.InsertHorizontalSplit(0)
    

    To write code in C#

    C#
    Copy Code
    // Create a Split on the left.
    this.c1List1.InsertHorizontalSplit[0];        
    // Create another Split on the left.        
    this.c1List1.InsertHorizontalSplit[0];
    

    The resulting list display will look like this:

    All three splits will have the same HScrollBar and VScrollBar settings and a VerticalScrollGroup setting of 1. However, only one vertical scroll bar will be displayed, within the rightmost split. When the user operates this scroll bar, all three splits will scroll simultaneously.

    Vertical splits react in the same manner. After adding two vertical splits to the list, all of the splits have the same HorizontalScrollGroup value of 1. Thus there is only one horizontal scroll bar at the bottom of the list, and if this scroll bar is scrolled, all three splits will scroll simultaneously.

    You can change one of the scroll group properties of the splits to create split groups that scroll independently. In the preceding example, setting the HorizontalScrollGroup property of the middle split to 2 creates a new scroll group:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Me.C1List1.Splits.Item(0, 1).HorizontalScrollGroup = 2
    

    To write code in C#

    C#
    Copy Code
    this.c1List1.Splits.Item[0, 1].HorizontalScrollGroup = 2;
    

    After this statement executes, scrolling the middle split will not disturb the others, as shown in the following figure:

    Note that the middle split now contains a horizontal scroll bar. This scroll bar operates only on the middle split, since it is the only one with its HorizontalScrollGroup property equal to 2. The horizontal scroll bar in the bottom most split now controls the bottom and top splits only. It no longer affects the middle split.

    A common application of this feature is to create two independent split groups so that users can compare field values from different records by scrolling each split to view a different set of rows.