GrapeCity MultiRow Windows Forms Documentation
Selection Mode

The GcMultiRow control provides two types of user selection modes. The developer can add or delete the selected cells, retrieve the selection, and set the appearance of the selected cells. Refer to Selecting Cells using Headers for details on the selection of cells using headers.

Multi Select Mode

GcMultiRow supports the selection of multiple cells by default. The user can select multiple cells by dragging the cells, clicking on the header, or by clicking or dragging the cells while pressing the Ctrl key. The following image shows cells being dragged in the multi select mode. The triangle icon depicts the mouse cursor.

Multi Select mode and Dragging

You can select discontinuous cells when you click on the cells while pressing the Ctrl key.

Multi Select mode and Mouse Click

Using Code

The following code sets the MultiSelect property for the GcMultiRow control.

[VB]

GcMultiRow1.MultiSelect = True

[CS]

gcMultiRow1.MultiSelect = true;

Single Select Mode

This specifies whether the developer will let the user select a single cell or multiple cells at a time. To enable the single select mode, set the GcMultiRow.MultiSelect property to False.

Single Select Mode

Using Code

The following code sets the single select mode for the GcMultiRow control.

[VB]

GcMultiRow1.MultiSelect = False

[CS]

gcMultiRow1.MultiSelect = false;

Cell Selection

You can select or delete the cell selection using the Cell.Selected property.

Using Code

The following example selects a cell.

[VB]

GcMultiRow1.Rows(0).Cells(1).Selected = True

[CS]

gcMultiRow1.Rows[0].Cells[1].Selected = true;

For selecting and deleting the selection of rows, use the Row.Selected property (Section.Selected property).

Using Code

The following example selects a row.

[VB]

GcMultiRow1.Rows(0).Selected = True

[CS]

gcMultiRow1.Rows[0].Selected = true;

Retrieving the Selection

To determine whether the cells or rows are selected, refer to Selected Rows and Cells.

Cell Appearance in the Selected State

The background and the foreground of the cells change to display them in a selected state when the cells are selected. The backcolor and forecolor use the CellStyle.SelectionBackColor property and the CellStyle.SelectionForeColor property, but the effect of the rendering varies depending on the rendering process and the style settings. For details, refer to Cell Styles.

Reversing the Selection

Set the GcMultiRow.AllowUserToReverseSelect property to True to reverse the selection of the already selected cells, or, in other words, to delete the selection of some of the cells from a selected range. In this case, the user can reverse the selection by pressing Ctrl with the mouse click.

Using Code

The following code lets users reverse the selection by pressing the Ctrl key while clicking.

[VB]

GcMultiRow1.AllowUserToReverseSelect = True

[CS]

gcMultiRow1.AllowUserToReverseSelect = true;

Multiple Selection using Shift Key

Set the GcMultiRow.AllowUserToShiftSelect property to True to be able to select multiple cells, either by specifying the start and end of the selection while pressing the Shift key, or by dragging the mouse over the selection while pressing the Shift key.

Using Code

The following example sets the grid to allow users to select multiple cells while pressing the Shift key.

[VB]

GcMultiRow1.AllowUserToShiftSelect = True

[CS]

gcMultiRow1.AllowUserToShiftSelect = true;

To allow mouse handling and to disable keyboard handling, delete the shortcut keys that are associated with this operation.

Using Code

The following code lets the user press Shift and use the mouse to select multiple cells, but not to use the keyboard and Shift to select multiple cells.

[VB]

Imports GrapeCity.Win.MultiRow

GcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftDown)
GcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftLeft)
GcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftPageDown)
GcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftPageUp)
GcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftRight)
GcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftToFirstCell)
GcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftToFirstCellInRow)
GcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftToFirstRow)
GcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftToLastCell)
GcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftToLastCellInRow)
GcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftToLastRow)
GcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftToNextRow)
GcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftToPreviousRow)
GcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftUp)

[CS]

using GrapeCity.Win.MultiRow;

gcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftDown);
gcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftLeft);
gcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftPageDown);
gcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftPageUp);
gcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftRight);
gcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftToFirstCell);
gcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftToFirstCellInRow);
gcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftToFirstRow);
gcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftToLastCell);
gcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftToLastCellInRow);
gcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftToLastRow);
gcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftToNextRow);
gcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftToPreviousRow);
gcMultiRow1.ShortcutKeyManager.Unregister(SelectionActions.ShiftUp);
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options