设置为CheckBoxCellType的单元格只要设置单元格的Value就可以设置是否为选中状态,通过Locked属性就可以将该单元格设置为不可编辑状态:
[code] private void Form1_Load(object sender, EventArgs e)
{
FarPoint.Win.Spread.CellType.CheckBoxCellType chk = new FarPoint.Win.Spread.CellType.CheckBoxCellType();
fpSpread1.Sheets[0].Columns[0].CellType = chk;
fpSpread1.Sheets[0].Cells[1, 0].Value = 1;
fpSpread1.Sheets[0].Cells[1, 0].Locked = true;
fpSpread1.Sheets[0].Cells[2, 0].Value = 0;
fpSpread1.Sheets[0].Cells[2, 0].Locked = true;
fpSpread1.Sheets[0].Cells[3, 0].Value = true;
fpSpread1.Sheets[0].Cells[3, 0].Locked = true;
fpSpread1.Sheets[0].Cells[4, 0].Value = false;
fpSpread1.Sheets[0].Cells[4, 0].Locked = true;
}code] |