【コマンドボタン型セル】ボタンの色(ButtonColor プロパティ)を変更できません

文書番号 : 33466     文書種別 : 使用方法     登録日 : 2012/11/14     最終更新日 : 2014/08/29
文書を印刷する
対象製品
SPREAD for Windows Forms 7.0J
詳細
コマンドボタン型セルの「ボタンの色」を変更したい場合は、UseVisualStyleBackColorプロパティをFalse(デフォルト値はTrue)に設定するかVisualStylesをOffに設定する必要があります。

◎サンプルコード(VB)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  Me.Text = FpSpread1.ProductVersion

  Dim bc1 As New FarPoint.Win.Spread.CellType.ButtonCellType
  bc1.ButtonColor = Color.Blue
  ' UseVisualStyleBackColorを設定   
  bc1.UseVisualStyleBackColor = False
  FpSpread1.ActiveSheet.Cells(0, 0).CellType = bc1

  ' VisualStylesをOffに設定
  FpSpread1.ActiveSheet.Cells(2, 0).VisualStyles = FarPoint.Win.VisualStyles.Off
  Dim bc2 As New FarPoint.Win.Spread.CellType.ButtonCellType
  bc2.ButtonColor = Color.Blue
  FpSpread1.ActiveSheet.Cells(2, 0).CellType = bc1
End Sub


◎サンプルコード(C#)
private void Form1_Load(object sender, EventArgs e)
{
  FarPoint.Win.Spread.CellType.ButtonCellType bc1 = new FarPoint.Win.Spread.CellType.ButtonCellType();
  bc1.ButtonColor = System.Drawing.Color.Blue;
  // UseVisualStyleBackColorを設定   
  bc1.UseVisualStyleBackColor = false;
  fpSpread1.ActiveSheet.Cells[0, 0].CellType = bc1;

  // VisualStylesをOffに設定 
  fpSpread1.ActiveSheet.Cells[2, 0].VisualStyles = FarPoint.Win.VisualStyles.Off;
  FarPoint.Win.Spread.CellType.ButtonCellType bc2 = new FarPoint.Win.Spread.CellType.ButtonCellType();
  bc2.ButtonColor = System.Drawing.Color.Blue;
  fpSpread1.ActiveSheet.Cells[2, 0].CellType = bc2;
}