解决使用spread时快捷键无反应的情况
2008-06-19 15:24
如果我的画面中有快捷键,比如说“F1”、“F2”、“F3”等等,当你的焦点在spread里边时,
你会发现你定义的那些快捷键有时候不反应,原因是焦点陷入spread里面,导致画面捕捉不到快捷键。
FarPoint.Win.Spread.InputMap im;
// spdResult是你画面中定义的spread的名字。 // WhenFocused:焦点离开时 im = spdResult.GetInputMap(InputMapMode.WhenFocused); // 按回车键和TAB时,焦点移动到下一个单元格 im.Put( new Keystroke(Keys.Enter,Keys.None),SpreadActions.MoveToNextColumnWrap); im.Put( new Keystroke(Keys.Tab,Keys.None),SpreadActions.MoveToNextColumnWrap); // 按→、↓、←、↑时,焦点移动 im.Put( new Keystroke(Keys.Left,Keys.None),SpreadActions.MoveToPreviousColumn); im.Put( new Keystroke(Keys.Right,Keys.None),SpreadActions.MoveToNextColumn); // 使快捷键有效 im.Put( new Keystroke(Keys.F1,Keys.None),SpreadActions.None); im.Put( new Keystroke(Keys.F2,Keys.None),SpreadActions.None); im.Put( new Keystroke(Keys.F3,Keys.None),SpreadActions.None); im.Put( new Keystroke(Keys.F8,Keys.None),SpreadActions.None); im.Put( new Keystroke(Keys.F10,Keys.None),SpreadActions.None); im.Put( new Keystroke(Keys.F12,Keys.None),SpreadActions.None); // WhenAncestorOfFocused:得到焦点时 im = spdResult.GetInputMap(InputMapMode.WhenAncestorOfFocused); im.Put( new Keystroke(Keys.Enter,Keys.None),SpreadActions.MoveToNextColumnWrap); im.Put( new Keystroke(Keys.Tab,Keys.None),SpreadActions.MoveToNextColumnWrap); im.Put( new Keystroke(Keys.Left,Keys.None),SpreadActions.MoveToPreviousColumn); im.Put( new Keystroke(Keys.Right,Keys.None),SpreadActions.MoveToNextColumn); im.Put( new Keystroke(Keys.F1,Keys.None),SpreadActions.None); im.Put( new Keystroke(Keys.F2,Keys.None),SpreadActions.None); im.Put( new Keystroke(Keys.F3,Keys.None),SpreadActions.None); im.Put( new Keystroke(Keys.F8,Keys.None),SpreadActions.None); im.Put( new Keystroke(Keys.F10,Keys.None),SpreadActions.None); im.Put( new Keystroke(Keys.F12,Keys.None),SpreadActions.None); |