FlexGrid for WinForms
Cell Selection
Show AllShow All
Hide AllHide All

The grid has a cursor cell, which displays a focus rectangle while the grid is active. The user may move the cursor with the keyboard or the mouse, and edit the contents of the cell if the grid is editable.


Notice that the Office Visual Styles also indicate the location of the cursor cell by highlighting the row and column headers of the cursor cell's position. For more information about setting the Visual Style, see Customizing Appearance Using Visual Styles.

You can get or set the current cell in code using the Row and Col properties. Setting either of these properties to –1 hides the cursor.

The grid supports extended selections, rectangular ranges of cells defined by two opposing corners: the cursor cell and the cell selection cell.


Notice that the Office Visual Styles also indicate the location of the extended selection by highlighting the row and column headers of the selected cells. For more information about setting the Visual Style, see Customizing Appearance Using Visual Styles.

You can get or set the selection cell in code using the RowSel and ColSel properties, or by using the Select method.

Note: When the cursor cell changes, the selection is automatically reset. To create extended selections in code, either set Row and Col before RowSel and ColSel, or use the Select method.
The appearance of the selection is controlled by the following properties:

The type of selection available is determined by the SelectionMode property. By default, the grid supports regular range selections. You can modify this behavior to prevent extended selections, to select by row, by column, or in listbox mode (listbox mode allows you to select individual rows).

When using the listbox selection mode, you can get or set the selection status for individual rows using the Selected property. You can also retrieve a collection of selected rows using the Selected property. For example, the code below selects all rows that satisfy a condition:

To write code in Visual Basic

To write code in C#

See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Product Support Forum |  Documentation Feedback