| SPREAD for Windows Forms 10.0J サンプルコード集 > 操作 > シート > 選択色を変更する |
SheetViewクラスのSelectionStyleプロパティを「SelectionStyles.SelectionColors」に指定することで、SelectionBackColorプロパティ(背景色)およびSelectionForeColorプロパティ(前景色)による選択範囲の描画を行うことができます。

![]() |
|
private void Form1_Load(object sender, System.EventArgs e) { fpSpread1.ActiveSheet.OperationMode = FarPoint.Win.Spread.OperationMode.SingleSelect; //セルの選択中はSelectionForeColorとSelectionBackColorを使用します fpSpread1.ActiveSheet.SelectionStyle = FarPoint.Win.Spread.SelectionStyles.SelectionColors; fpSpread1.ActiveSheet.SelectionBackColor = Color.Red; fpSpread1.ActiveSheet.SelectionForeColor = Color.White; fpSpread1.ActiveSheet.DefaultStyle.CellType = new FarPoint.Win.Spread.CellType.TextCellType(); fpSpread1.ActiveSheet.Cells[1, 0, 1, 4].Text = "Select"; }
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load FpSpread1.ActiveSheet.OperationMode = FarPoint.Win.Spread.OperationMode.SingleSelect 'セルの選択中はSelectionForeColorとSelectionBackColorを使用します FpSpread1.ActiveSheet.SelectionStyle = FarPoint.Win.Spread.SelectionStyles.SelectionColors FpSpread1.ActiveSheet.SelectionBackColor = Color.Red FpSpread1.ActiveSheet.SelectionForeColor = Color.White FpSpread1.ActiveSheet.DefaultStyle.CellType = New FarPoint.Win.Spread.CellType.TextCellType FpSpread1.ActiveSheet.Cells(1, 0, 1, 4).Text = "Select" End Sub