可以在Spread提供的ButtonClicked事件中来实现这一功能:
- private void Form1_Load(object sender, EventArgs e)
- {
- FarPoint.Win.Spread.CellType.CheckBoxCellType cbct = new FarPoint.Win.Spread.CellType.CheckBoxCellType();
- fpSpread1.ActiveSheet.Columns[0, 1].CellType = cbct;
- }
- private void fpSpread1_ButtonClicked(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
- {
- if (e.Column == 0 || e.Column == 1)
- {
- int col = e.Column == 0 ? 1 : 0;
- if (((FarPoint.Win.FpCheckBox)(e.EditingControl)).Checked && fpSpread1.ActiveSheet.Cells[e.Row, col].Value != null && (bool)fpSpread1.ActiveSheet.Cells[e.Row, col].Value)
- {
- fpSpread1.ActiveSheet.Cells[e.Row, col].Value = false;
- }
- }
- }
复制代码 |