回复 1楼miyaminn的帖子
miyaminn 你好,
需要通过 PreviewKeyDown 事件来捕获 Control 点击事件来实现,测试代码如下:
- private void Form1_Load(object sender, EventArgs e)
- {
- this.fpSpread1_Sheet1.SelectionPolicy = FarPoint.Win.Spread.Model.SelectionPolicy.MultiRange;
- this.fpSpread1_Sheet1.SelectionUnit = FarPoint.Win.Spread.Model.SelectionUnit.Row;
- this.fpSpread1.CellClick += fpSpread1_CellClick;
- this.fpSpread1.PreviewKeyDown += fpSpread1_PreviewKeyDown;
- }
- bool isControlKey = false;
- void fpSpread1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
- {
- if (e.Control)
- {
- isControlKey = true;
- }
- else
- {
- isControlKey = false;
- }
- }
- void fpSpread1_CellClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e)
- {
- if (e.RowHeader&&isControlKey)
- {
- e.Cancel = true;
- }
- }
复制代码
需要考虑的是,其他和 Control 键组合的快捷键也会被屏蔽。 |