在Spread for WinForms 6.0中可以参照下面的实现方法:
- private void Form1_Load(object sender, EventArgs e)
- {
- FarPoint.Win.Spread.CellType.CheckBoxCellType cbct = new FarPoint.Win.Spread.CellType.CheckBoxCellType();
- fpSpread1.ActiveSheet.ColumnHeader.Cells[0, 0].CellType = cbct;
- fpSpread1.ActiveSheet.ColumnHeader.Cells[0, 0].Value = true;
- }
- private void fpSpread1_CellClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e)
- {
- if (e.ColumnHeader && e.Column == 0)
- {
- fpSpread1.ActiveSheet.ColumnHeader.Cells[0, 0].Value = !((bool)fpSpread1.ActiveSheet.ColumnHeader.Cells[0, 0].Value);
- for (int i = 0; i < fpSpread1.ActiveSheet.RowCount; i++)
- {
- fpSpread1.ActiveSheet.Cells[i, 0].Value = fpSpread1.ActiveSheet.ColumnHeader.Cells[0, 0].Value;
- }
- }
- }
复制代码 |