MESCIUS SPREAD for ASP.NET 10.0J
ButtonCellType コンストラクタ(String)

ユーザーがボタンをクリックしたときに実行するコマンドの文字列
コマンドを指定して、新しいコマンド ボタン型セルを作成します。
構文
'Declaration
 
Public Function New( _
   ByVal cmd As String _
)
public ButtonCellType( 
   string cmd
)

パラメータ

cmd
ユーザーがボタンをクリックしたときに実行するコマンドの文字列
この例では、スプレッドシートを作成し、セルの最初の2列をコマンドボタン型セルに設定し、「MyRed」と「MyBlue」というCommandNamesのボタンを構築して、このコンストラクタの使い方を示します(ButtonCommandイベントで、CommandNamesを問い合わせ、CommandNameに応じてスプレッドシートの背景色を変更します)。
FarPoint.Web.Spread.ButtonCellType btn = new FarPoint.Web.Spread.ButtonCellType("MyRed");
FarPoint.Web.Spread.ButtonCellType btn1 = new FarPoint.Web.Spread.ButtonCellType("MyBlue");
FarPoint.Web.Spread.StyleInfo style = new FarPoint.Web.Spread.StyleInfo();
FarPoint.Web.Spread.StyleInfo style1 = new FarPoint.Web.Spread.StyleInfo();
FpSpread1.Sheets[0].ColumnCount = 7;
FpSpread1.Sheets[0].RowCount = 50;
btn.ButtonType = FarPoint.Web.Spread.ButtonType.PushButton;
btn1.ButtonType = FarPoint.Web.Spread.ButtonType.PushButton;
btn.CommandName = "MyRed";
btn1.CommandName = "MyBlue";
style.CellType = btn;
style1.CellType = btn1;
FpSpread1.Sheets[0].SetStyleInfo(-1, 0, style);
FpSpread1.Sheets[0].SetStyleInfo(-1, 1, style1);

private void FpSpread1_ButtonCommand(object sender, FarPoint.Web.Spread.SpreadCommandEventArgs e)
{
    if(e.CommandName == "MyRed")
    {
        FpSpread1.BackColor = Color.Red;
    }
    else if(e.CommandName == "MyBlue")
    {
        FpSpread1.BackColor = Color.Blue;
    }
}
Dim btn As New FarPoint.Web.Spread.ButtonCellType("MyRed")
Dim btn1 As New FarPoint.Web.Spread.ButtonCellType("MyBlue")
Dim style As New FarPoint.Web.Spread.StyleInfo()
Dim style1 As New FarPoint.Web.Spread.StyleInfo()
FpSpread1.Sheets(0).ColumnCount = 7
FpSpread1.Sheets(0).RowCount = 50
btn.ButtonType = FarPoint.Web.Spread.ButtonType.PushButton
btn1.ButtonType = FarPoint.Web.Spread.ButtonType.PushButton
btn.CommandName = "MyRed"
btn1.CommandName = "MyBlue"
style.CellType = btn
style1.CellType = btn1
FpSpread1.Sheets(0).SetStyleInfo(-1, 0, style)
FpSpread1.Sheets(0).SetStyleInfo(-1, 1, style1)

Private Sub FpSpread1_ButtonCommand(ByVal sender As Object, ByVal e As FarPoint.Web.Spread.SpreadCommandEventArgs) Handles
FpSpread1.ButtonCommand
    If e.CommandName = "MyRed" Then
        FpSpread1.BackColor = Color.Red
    ElseIf e.CommandName = "MyBlue" Then
        FpSpread1.BackColor = Color.Blue
    End If
End Sub
参照

ButtonCellType クラス
ButtonCellType メンバ
オーバーロード一覧
CommandName プロパティ

 

 


© MESCIUS inc. All rights reserved.