回复 1楼year2001的帖子
这个case需要结合几个事件来做:
- private void Form1_Load(object sender, EventArgs e)
- {
- this.fpSpread1.CellClick += fpSpread1_CellClick;
- this.fpSpread1.KeyDown += fpSpread1_KeyDown;
- this.fpSpread1.KeyUp += fpSpread1_KeyUp;
- }
- int key = 0;
- bool isShiftKeyDown = true;
- void fpSpread1_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode== Keys.ShiftKey)
- {
- key = e.KeyValue;
- isShiftKeyDown = true;
- }
- }
- void fpSpread1_KeyUp(object sender, KeyEventArgs e)
- {
- if (e.KeyCode== Keys.ShiftKey)
- {
- isShiftKeyDown = false;
- }
- }
- void fpSpread1_CellClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e)
- {
- if (key==16&&isShiftKeyDown)
- {
- e.Cancel = true;
- }
- }
复制代码 |