回复 4楼wangmj的帖子
请参考以下代码:
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- fpSpread1.ActiveSheet.Cells[0, 0].CellType = new CCheckBoxCellType();
- }
- }
- public class CCheckBoxCellType : FarPoint.Win.Spread.CellType.CheckBoxCellType
- {
- public override Control GetEditorControl(Control parent, FarPoint.Win.Spread.Appearance appearance, float zoomFactor)
- {
- var editor = base.GetEditorControl(parent, appearance, zoomFactor);
- editor.KeyDown -= new KeyEventHandler(editor_KeyDown);
- editor.KeyDown += new KeyEventHandler(editor_KeyDown);
- return editor;
- }
- void editor_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyValue == 97)
- {
- FarPoint.Win.FpCheckBox editor = sender as FarPoint.Win.FpCheckBox;
- editor.Checked = !editor.Checked;
- }
- }
- }
复制代码 |