Navigation: User Interface > Run-time Interaction >

Creating and Resizing Splits

 

 

 

Users can create and resize splits interactively by setting the AllowHorizontalSplit or AllowVerticalSplit property of a grid to True. By default, both properties are set to False, preventing users from creating and resizing splits. Use the context-menu or right-click and select Split to turn the property to True.

A typical grid with these properties set to False is shown in the following figure. Notice that there is no split box at the left edge of the horizontal scroll bar or at the top of the vertical scroll bar.


 

The new split will inherit its properties from the original split. The SplitSizeMode properties of both splits will be automatically set to SizeModeEnum.Scalable, regardless of the SplitSizeMode of the original split. The SplitSize properties of both splits will be set to the correct ratio of the splits' sizes. The values of the SplitSize properties may end up being rather large. This is because True DBGrid for WinForms needs to choose the least common denominator for the total split size, and the user may drag the pointer to an arbitrary position.

Vertical Splits

If the split's AllowVerticalSplit property is set to True:

To write code in Visual Basic

To write code in C#

A split box will appear at the top edge of the vertical scroll bar, and when the cursor is over the split box, it will turn into a double horizontal bar with vertical arrows. Dragging the cursor down from the split box creates a new split.


 

Once a split has been created, dragging the cursor up or down adjusts the relative size of the splits.


 

Horizontal Splits

If the split's AllowHorizontalSplit property is set to True:

To write code in Visual Basic

To write code in C#

A split box will appear at the left edge of the horizontal scroll bar, and when the cursor is over the split box, it will turn into a double vertical bar with horizontal arrows. Dragging the cursor to the left from the split box creates a new split.

Once a split has been created, dragging the cursor to the left or right adjusts the relative size of the splits.


 

Summary

Splits can always be created or resized in code, but the AllowHorizontalSplit and AllowVerticalSplit property control whether users can create or resize splits interactively at run time.

The user can resize the relative sizes of two splits only if both splits' AllowSizing properties are True. When the user completes a resize operation, the total size of the two splits remains unchanged, but the SplitSizeMode properties of both splits will automatically be set to SizeModeEnum.Scalable regardless of their previous settings. The SplitSize properties of the two splits will be set to reflect the ratio of their new sizes.

Below is a screenshot for creating and resizing splits horizontally and vertically.

play stop

splitrecord

 

 

 

 

 

Copyright © 2021 Terasoft Corporation

 

 



.