MultiRow Windows Forms > Developer's Guide > Using MultiRow > Column Mode > Column Operation |
This section describes the various operations that can be implemented in the Column mode.
Since the rows and columns are reversed in the column mode, when you perform a column operation, the processing that is carried out is the same as that for the row operation, in the default template mode (when the Template.LayoutMode property is set to TopToBottom).
You can use the GcMultiRow.RowCount property to get and set the number of columns. For details, refer to Getting and Setting the Row Count.
The column count cannot be changed using the GcMultiRow.RowCount property, if the GcMultiRow control is bound to a data source. In such cases, you will need to change the row count (record count) in the data source itself. |
The following code sets the number of columns in the GcMultiRow control to 10.
GcMultiRow1.RowCount = 10 |
gcMultiRow1.RowCount = 10; |
The following code outputs the current column count of the GcMultiRow control in the console window.
Console.WriteLine(GcMultiRow1.RowCount) |
Console.WriteLine(gcMultiRow1.RowCount); |
You can use the Row.Visible property (Section.Visible property) to show or hide specific columns. For details, please refer to Hiding Cells and Rows.
The following code toggles the visibility of the second column.
If GcMultiRow1.Rows(2).Visible Then GcMultiRow1.Rows(2).Visible = False Else GcMultiRow1.Rows(2).Visible = True End If |
if (gcMultiRow1.Rows[2].Visible) { gcMultiRow1.Rows[2].Visible = false; } else { gcMultiRow1.Rows[2].Visible = true; } |
You can use the GcMultiRow.FreezeTopRowCount property to freeze the column at the extreme left. In addition, you can use the GcMultiRow.FreezeBottomRowCount property to freeze the column at the extreme right. For details, refer to Freezing Rows.
The following code freezes two columns on the extreme left, and one column on the extreme right.
GcMultiRow1.FreezeTopRowCount = 2 GcMultiRow1.FreezeBottomRowCount = 1 |
gcMultiRow1.FreezeTopRowCount = 2; gcMultiRow1.FreezeBottomRowCount = 1; |
You can select or delete the selected columns using the Row.Selected property (Section.Selected property). For details, refer to Selection Mode.
The following code selects the first column.
GcMultiRow1.Rows(0).Selected = True |
gcMultiRow1.Rows[0].Selected = true; |
You can use the Cell.HorizontalResize method to change the column width. For details, refer to Resizing.
The following code increases the width of the first column by 10 pixels.
GcMultiRow1.Rows(0).Cells(0).HorizontalResize(10) |
gcMultiRow1.Rows[0].Cells[0].HorizontalResize(10); |
Use the Row.ReadOnly property (Section.ReadOnly property) to set specific columns as read-only. For details, refer to Read-Only Cells.
Use the following code to set the first column as read-only.
GcMultiRow1.Rows(0).ReadOnly = True |
gcMultiRow1.Rows[0].ReadOnly = true; |
Use the Row.Selectable property (Section.Selectable property) to restrict the selection of specific columns. For details, refer to Restricting Cell Selection.
The following code restricts the selection of the first column.
GcMultiRow1.Rows(0).Selectable = False |
gcMultiRow1.Rows[0].Selectable = false; |