ComponentOne List for WinForms
In This Topic
    Sizing and Scaling Splits
    In This Topic

    List for WinForms gives you full control over the size and scaling of individual splits. You can configure a split to occupy an exact width or height, hold a fixed number of columns or rows, or adjust its size proportionally in relation to other splits. If you are just starting out with List for WinForms, you can use splits in a variety of ways without having to master all of the details.

    At run time, the actual size of a Split object depends upon its SplitSize and SplitSizeMode properties. The SplitSizeMode property specifies the unit of measurement; the SplitSize property specifies the number of units. List for WinForms supports three different sizing modes for splits, as determined by the setting of the SplitSizeMode property:

    Sizing Mode Description
    Scalable The SplitSize indicates the relative size of the split with respect to other scalable splits.
    Exact The SplitSize indicates the size of the split in pixels.
    NumberofColumns The SplitSize indicates the number of columns displayed in the split.

    A scalable split uses the value of its SplitSize property to determine the percentage of space the split will occupy. For any scalable split, the percentage is determined by dividing its SplitSize value by the sum of the SplitSize values of all other scalable splits. Thus, you can consider the SplitSize property of a scalable split to be the numerator of a fraction, the denominator of which is the sum of the scalable split sizes. Scalable splits compete for the space remaining after nonscalable splits have been allocated. By default, all splits are scalable, so they compete for the entire list display region. SplitSizeMode is always Scalable when a list contains only one split.

    An exact split uses the value of its SplitSize property as its fixed width in container coordinates. Exact splits will be truncated if they will not fit within the horizontal list boundaries. This mode is not applicable when a list contains only one split.

    A fixed-column split uses the SplitSize property to indicate the exact number of columns that should always be displayed within the split. These splits automatically reconfigure the entire list if the size of the displayed columns changes (either by code or user interaction), or if columns in the split are scrolled horizontally so that the widths of the displayed columns are different. This mode is primarily used to create fixed columns that do not scroll horizontally. However, it can be used for a variety of other purposes as well. This mode is not applicable when a list contains only one split.

    Note that when there is only one split (the list's default behavior), the split spans the entire width of the list, the SplitSizeMode property is always Scalable, and the SplitSize property is always 1. Setting either of these properties has no effect when there is only one split. If there are multiple splits, and you then remove all but one, the SplitSizeMode and SplitSize properties of the remaining split automatically revert to 0 and 1, respectively.

    By default, the SplitSizeMode property for a newly created split is Scalable, and the SplitSize property is set to 1. 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:

    Notice that each split occupies 1/3 of the total list space. This is because there are three scalable splits, and each split has a SplitSize of 1. If you change the sizes of the splits to 1, 2, and 3, respectively:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    ' Change relative size to 1.      
    Me.C1List1.Splits(0).SplitSize = 1 
      
    ' Change relative size to 2.     
    Me.C1List1.Splits(1).SplitSize = 2 
      
    ' Change relative size to 3.     
    Me.C1List1.Splits(2).SplitSize = 3
    

    To write code in C#

    C#
    Copy Code
    // Change relative size to 1.
    this.c1List1.Splits[0].SplitSize = 1
    
    // Change relative size to 2.
    this.c1List1.Splits[1].SplitSize = 2
    
    // Change relative size to 3.
    this.c1List1.Splits[2].SplitSize = 3
    

    The resulting list display will look like this:

    Notice the sum of the split sizes (1+2+3) is 6, so the size of each split is a fraction with the numerator being the value of its SplitSize property and a denominator of 6.

    When a split's SplitSizeMode is set to Exact, that split receives space before the other splits. This behavior is somewhat more complex, but understanding how scalable splits work is helpful. For example, assume that splits are set in the following way:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Me.C1List1.Splits(0).SplitSizeMode = C1.Win.C1List.SizeModeEnum.Scalable
    Me.C1List1.Splits(0).SplitSize = 1
    Me.C1List1.Splits(1).SplitSizeMode = C1.Win.C1List.SizeModeEnum.Exact
    Me.C1List1.Splits(1).SplitSize = 250
    Me.C1List1.Splits(2).SplitSizeMode = C1.Win.C1List.SizeModeEnum.Scalable
    Me.C1List1.Splits(2).SplitSize = 2
    

    To write code in C#

    C#
    Copy Code
    this.c1List1.Splits[0].SplitSizeMode = C1.Win.C1List.SizeModeEnum.Scalable;        
    this.c1List1.Splits[0].SplitSize = 1;   
    this.c1List1.Splits[1].SplitSizeMode = C1.Win.C1List.SizeModeEnum.Exact;
    this.c1List1.Splits[1].SplitSize = 250;
    this.c1List1.Splits[2].SplitSizeMode = C1.Win.C1List.SizeModeEnum.Scalable;
    this.c1List1.Splits[2].SplitSize = 2;
    

    After configuring the splits in this way, the resulting list display will look like this:

    The fixed-size split in the middle (Split1) is configured to exactly 250 pixels, and the remaining splits compete for the space remaining in the list. Since the remaining splits are both scalable splits, they divide the remaining space among themselves according to the percentages calculated using their SplitSize property values. So, the leftmost split occupies 1/3 of the remaining space, and the rightmost split occupies 2/3.

    Splits with SplitSizeMode set to NumberofColumns behave almost identically to exact splits, except their size is determined by the width of an integral number of columns. The width, however, is dynamic, so resizing the columns or scrolling so that different columns are in view will cause the entire list to reconfigure itself.

    Avoid creating a list with no scalable splits. Although List for WinForms handles this situation, it is difficult to work with a list configured in this way. For example, if no splits are scalable, all splits will have an exact size, which may not fill the entire horizontal width of the list. If the total width of the splits is too short, List for WinForms displays a "null-zone" where there are no splits. If the total width of the splits is wider than the list, then List for WinForms will show only the separator lines for the splits that cannot be shown.