可以使用自定义的Action来实现只删除数据:
- InputMap im = spread.GetInputMap(InputMapMode.WhenFocused);
- ActionMap am = spread.GetActionMap();
- im.Put(new Keystroke(Keys.D9, Keys.Control), "HideRow");
- im.Put(new Keystroke(Keys.D9, Keys.Control | Keys.Shift), "UnhideRow");
- am.Put("HideRow", new HideRowAction());
- am.Put("UnhideRow", new UnhideRowAction());
复制代码- public class ClearValueAction : FarPoint.Win.Spread.Action
- {
- public override void PerformAction(object source)
- {
- if (source is SpreadView)
- {
- SpreadView spread = (SpreadView)source;
- SheetView sheet = spread.Sheets[spread.ActiveSheetIndex];
- CellRange cr = sheet.GetSelection(0);
- for (int r = 0; r < cr.RowCount; r++)
- {
- for (int c = 0; c < cr.ColumnCount; c++)
- {
- sheet.Cells[cr.Row + r, cr.Column + c].ResetValue();
- }
- }
- }
- }
- }
复制代码 |