Spread Windows Forms 14.0
Spread Windows Forms 14.0 Product Documentation / Developer's Guide / Cells / Working with the Active Cell
In This Topic
    Working with the Active Cell
    In This Topic

    The active cell is the cell that currently receives any user interaction. The active cell is the single cell that has keyboard focus. There is always an active cell. Usually, the active cell displays some indication that it is in focus.

    You can specify the active cell programmatically using the SetActiveCell method of the SheetView class. You can also use the ActiveCell property to find the active cell coordinates.

    The active cell is stored in the ActiveRowIndex and ActiveColumnIndex properties in the SheetView class. The LeaveCell event is raised any time the active cell changes.

    You can change the focus indicator; for more information, refer to Customizing the Focus Indicator for a Cell.

    The cell selection is one or more cells that have been highlighted by the user or application. At any given time, there may or may not be a cell selection present. The cell selection (if present) is stored in the selection model inside the SheetView class. The Changed event (in the selection model) is raised any time the cell selection changes.

    Spread Windows Forms has two implementations of selection coloring. When the SelectionStyle property is set to SelectionColors, the cell is painted using selection colors (that is, both SelectionBackColor and SelectionForeColor). When the SelectionStyle property is set to SelectionRenderer (which is the default), the cell is painted using normal coloring and then over painted with the SelectionRenderer. The default SelectionRenderer uses a semi-transparent version of the system's selection color.

    In RowMode, which is an operation mode where only rows can be selected, there is an active cell. The active row is painted similar to a selected row.

    Spread Windows Forms uses a painting scheme similar to Excel. If the cell is the active cell then the cell is painted using normal coloring and a focus box. If the cell is selected then the cell is painted using selection coloring, or else the cell is painted using normal coloring.

    There is a different painting scheme in OpenOffice. If the cell is both the active cell and a selected cell then the cell is painted using selection coloring and a focus box. Spread Windows Forms does not support OpenOffice's painting scheme.

    You can change what can be selected by the user. For more information, refer to Specifying What the User Can Select. You can also customize how the selection appears. For more information, refer to Customizing the Selection Appearance.

    Using a Shortcut

    You can use ActiveCell as a shortcut object for the active cell when specifying properties of that cell. Use the SetActiveCell to set the active cell.

    Example

    Set the active cell and do not clear previously selected cells.

    C#
    Copy Code
    fpSpread1.ActiveSheet.SetActiveCell(2, 2, false);
    
    VB
    Copy Code
    fpSpread1.ActiveSheet.SetActiveCell(2, 2, False)
    
    See Also