Selections have a default appearance provided by the component and the selection renderer. You can change that appearance, including the background and text colors as well as the border. By default, when you click on a row header, the entire row is selected and when you click on a column header, the entire column is selected. The active cell retains a different appearance to show you which cell is active. You can change the selection behavior by setting the OperationMode for the sheet.
Set the SheetView object’s SelectionBackColor and SelectionForeColor to specify the colors to use for the background and for the text (SelectionForeColor only applies to downlevel browsers). Set the SheetView object’s SelectionBorder to specify the border for selections (downlevel browser only). Assign the SheetView object you have created to one of the sheets in the component.
You can also change the appearance by setting the selection colors in a custom skin and applying that skin to the sheet. For more information about skins, refer to Creating a Skin for Sheets and Applying a Skin to a Sheet.
Using the Properties Window
- At design time, in the Properties window, select the FpSpread component.
- Select the Sheets property.
- Click the button to display the SheetView Collection Editor.
- Set the various selection properties.
- Click OK to close the editor.
Using a Shortcut
- Set the SelectionBackColorStyle property.
- Set the SelectionBackColor property.
- Set the SelectionPolicy pr0perty.
Example
This example code sets the selection backcolor and policies.
C# | Copy Code |
---|---|
FpSpread1.Sheets[0].SelectionBackColorStyle = FarPoint.Web.Spread.SelectionBackColorStyles.SelectionBackColor; FpSpread1.Sheets[0].SelectionBackColor = Color.SaddleBrown; FpSpread1.Sheets[0].SelectionPolicy = FarPoint.Web.Spread.Model.SelectionPolicy.MultiRange; |
VB | Copy Code |
---|---|
FpSpread1.Sheets(0).SelectionBackColorStyle = FarPoint.Web.Spread.SelectionBackColorStyles.SelectionBackColor FpSpread1.Sheets(0).SelectionBackColor = Color.SaddleBrown FpSpread1.Sheets(0).SelectionPolicy = FarPoint.Web.Spread.Model.SelectionPolicy.MultiRange |
Using the Spread Designer
- Select the Settings menu.
- Select the Colors icon from the Sheet Settings section.
- Set the various selection options. Click OK to close the dialog.
- From the File menu choose Apply and Exit to apply your changes to the component and exit Spread Designer.