回复 3楼zhuliwangfen的帖子
试试下面的代码:
- this.gcSpreadSheet1.View.KeyMap.Remove(new GrapeCity.Windows.SpreadSheet.UI.KeyStroke(Key.Delete, ModifierKeys.None));
- this.gcSpreadSheet1.KeyUp += new KeyEventHandler(gcSpreadSheet1_KeyUp);
- void gcSpreadSheet1_KeyUp(object sender, KeyEventArgs e)
- {
- if (e.Key == Key.Delete)
- {
- CellRange range = this.gcSpreadSheet1.ActiveSheet.Selections[0];
- if (range != null)
- {
- e.Handled = true;
- this.gcSpreadSheet1.ActiveSheet.Cells[range.Row, range.Column, range.RowCount + range.Row - 1, range.ColumnCount + range.Column - 1].Value = null;
- this.gcSpreadSheet1.Invalidate();
- }
- }
- }
复制代码 |