MultiRow Windows Forms > Developer's Guide > Using MultiRow > Grid > Resizing |
The cells in the GcMultiRow control can be resized in row units or column units.
When the Cell.ResizeMode property is set to Horizontal, the user can drag the left or right edges of the cell to resize the width. This will cause the size and position of other cells to change automatically. When it is set to Vertical, the cell height can be changed by dragging the top or bottom edges. If the property is set to Both, resizing can be performed using either of the previous methods. The end user will not be able to resize the cells when the value is set to None.
By default, the header cell is set to Both, the column header cell is set to Horizontal, the row header cell is Vertical, and cells other than these are set to None. To cancel the resizing operation, you can click the right button of the mouse or press Esc during the resizing.
Use the Cell.HorizontalResize method to resize the cells horizontally. Use the Cell.VerticalResize method to resize vertically.
The following code increases the size of the current cell by 10 pixels each.
Imports GrapeCity.Win.MultiRow If GcMultiRow1.CurrentCell IsNot Nothing Then GcMultiRow1.CurrentCell.HorizontalResize(10) GcMultiRow1.CurrentCell.VerticalResize(10) End If |
using GrapeCity.Win.MultiRow; if (gcMultiRow1.CurrentCell != null) { gcMultiRow1.CurrentCell.HorizontalResize(10); gcMultiRow1.CurrentCell.VerticalResize(10); } |
Use the return values of the Cell.Width property and the Cell.Height property to specify the size of the cell absolutely.
The following sample creates an offset based on the width of the cell.
Imports GrapeCity.Win.MultiRow Dim targetCell As Cell = GcMultiRow1.CurrentCell If targetCell IsNot Nothing Then Dim newWidth As Integer = 300 Dim offset As Integer = newWidth - targetCell.Width targetCell.HorizontalResize(offset) End If |
using GrapeCity.Win.MultiRow; Cell targetCell = gcMultiRow1.CurrentCell; if (targetCell != null) { int newWidth = 300; int offset = newWidth - targetCell.Width; targetCell.HorizontalResize(offset); } |