回复 1楼softroad的帖子
问题1:可以通过以下代码实现,这里举一个 Ctrl + Home 快捷键定义的例子:
- private void Form1_Load(object sender, EventArgs e)
- {
- this.fpSpread1.ActiveSheet.OperationMode = FarPoint.Win.Spread.OperationMode.SingleSelect;
- fpSpread1.ActiveSheet.Columns[0].CanFocus = false;
- InputMap im = fpSpread1.GetInputMap(InputMapMode.WhenFocused);
- ActionMap am = fpSpread1.GetActionMap();
- im.Put(new Keystroke(Keys.Home, Keys.Control), "NewControlHomeAction");
- am.Put("NewControlHomeAction", new NewControlHomeAction());
- }
- }
- ///<summary>
- ///Ctrl + Home 即选择Cell[0,0]
- ///</summary>
- public class NewControlHomeAction : FarPoint.Win.Spread.Action
- {
- public override void PerformAction(object source)
- {
- if (source is SpreadView)
- {
- SpreadView SpreadView = (SpreadView)source;
- SpreadView.Sheets[SpreadView.ActiveSheetIndex].SetActiveCell(0, 0);
- SpreadView.ShowActiveCell(VerticalPosition.Top, HorizontalPosition.Left);
- }
- }
- }
复制代码 |