可以在EditModeOn 事件中设置EditingControl的PreviewKeyDown事件
- fpSpread1.EditModeOn += FpSpread1_EditModeOn1;
- fpSpread1.EditModeOff += FpSpread1_EditModeOff1;
复制代码
-
- private void FpSpread1_EditModeOff1(object sender, EventArgs e)
- {
- fpSpread1.EditingControl.PreviewKeyDown -= EditingControl_PreviewKeyDown1;
- }
- private void FpSpread1_EditModeOn1(object sender, EventArgs e)
- {
- fpSpread1.EditingControl.PreviewKeyDown += EditingControl_PreviewKeyDown1;
- }
- private void EditingControl_PreviewKeyDown1(object sender, PreviewKeyDownEventArgs e)
- {
- if(e.KeyCode== Keys.Enter)
- {
- MessageBox.Show("回车");
-
- }
- }
复制代码 |