GrapeCity MultiRow Windows Forms Documentation
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).

Getting and Setting the Column Count

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.

Using Code

The following code sets the number of columns in the GcMultiRow control to 10.

[VB]

GcMultiRow1.RowCount = 10

[CS]

gcMultiRow1.RowCount = 10;

The following code outputs the current column count of the GcMultiRow control in the console window.

[VB]

Console.WriteLine(GcMultiRow1.RowCount)

[CS]

Console.WriteLine(gcMultiRow1.RowCount);

Show or Hide Columns

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.

Using Code

The following code toggles the visibility of the second column.

[VB]

If GcMultiRow1.Rows(2).Visible Then
GcMultiRow1.Rows(2).Visible = False 
Else 
GcMultiRow1.Rows(2).Visible = True 
End If

[CS]

if (gcMultiRow1.Rows[2].Visible) 
{
gcMultiRow1.Rows[2].Visible = false; 
} else { 
gcMultiRow1.Rows[2].Visible = true; 
}

Freezing Columns

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.

Using Code

The following code freezes two columns on the extreme left, and one column on the extreme right.

[VB]

GcMultiRow1.FreezeTopRowCount = 2 
GcMultiRow1.FreezeBottomRowCount = 1

[CS]

gcMultiRow1.FreezeTopRowCount = 2;
gcMultiRow1.FreezeBottomRowCount = 1;

Column Selection

You can select or delete the selected columns using the Row.Selected property (Section.Selected property). For details, refer to Selection Mode.

Using Code

The following code selects the first column.

[VB]

GcMultiRow1.Rows(0).Selected = True

[CS]

gcMultiRow1.Rows[0].Selected = true;

Resizing Column Width

You can use the Cell.HorizontalResize method to change the column width. For details, refer to Resizing.

Using Code

The following code increases the width of the first column by 10 pixels.

[VB]

GcMultiRow1.Rows(0).Cells(0).HorizontalResize(10)

[CS]

gcMultiRow1.Rows[0].Cells[0].HorizontalResize(10);

Read-Only Columns

Use the Row.ReadOnly property (Section.ReadOnly property) to set specific columns as read-only. For details, refer to Read-Only Cells.

Using Code

Use the following code to set the first column as read-only.

[VB]

GcMultiRow1.Rows(0).ReadOnly = True

[CS]

gcMultiRow1.Rows[0].ReadOnly = true;

Restricting Column Selection

Use the Row.Selectable property (Section.Selectable property) to restrict the selection of specific columns. For details, refer to Restricting Cell Selection.

Using Code

The following code restricts the selection of the first column.

[VB]

GcMultiRow1.Rows(0).Selectable = False

[CS]

gcMultiRow1.Rows[0].Selectable = false;
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options