回复 1楼怕瓦落地的帖子
正确。
生成按钮和事件对应的代码如下,请参考:
- 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;
- }
- }
复制代码 |