找回密码
 立即注册

QQ登录

只需一步,快速开始

jinqiong

论坛元老

33

主题

99

帖子

1万

积分

论坛元老

积分
16763

活字格认证

jinqiong
论坛元老   /  发表于:2014-5-27 17:48  /   查看:6667  /  回复:4
Spread的某个单元格在编辑状态下,
按Enter键,不能跳到下一个单元格,
而是从编辑状态变成了非编辑状态,
按两次Enter键才能跳到下一单元格

求帮助。。。
谢谢

4 个回复

倒序浏览
iceman
社区贡献组   /  发表于:2014-5-28 09:59:00
沙发
回复 1楼jinqiong的帖子

设置方法如下:

  1.         private void Form1_Load(object sender, EventArgs e)
  2.         {
  3.             FarPoint.Win.Spread.InputMap im = new FarPoint.Win.Spread.InputMap();
  4.             im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused);
  5.             im.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow);

  6.             //主要用于设置处于编辑状态时的快捷键行为
  7.             im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
  8.             im.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow);
  9.         }
复制代码
回复 使用道具 举报
紫藤
注册会员   /  发表于:2014-5-28 10:44:00
板凳
回复 2楼iceman的帖子

你好 版主
我们遇到了跟楼主类似的问题,
如果这里改成InputMapMode.WhenAncestorOfFocused
Spread里面的单列形式的ComboBox(ComboBoxCellType),按回车就一直停留在当前的ComboBox单元格内了,没法进入下一个单元格

请问,既想用WhenAncestorOfFocused,又想按回车能顺利通过ComboBox的单元格, 有办法解决吗?
回复 使用道具 举报
jinqiong
论坛元老   /  发表于:2014-5-28 11:21:00
地板
不好意思,没有说清楚,是跳到代码指定的单元格中,如何实现?
2楼的方法只能跳到下一个单元格
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2014-5-28 17:32:00
5#
回复 4楼jinqiong的帖子

那需要自定义 Action 来实现,请参考:
http://www.gcpowertools.com.cn/d ... #!Documents/_65.htm

关键代码:

  1. public overridevoid PerformAction(object source)
  2.         {
  3. if (source isSpreadView)
  4.             {
  5. SpreadView SpreadView = (SpreadView)source;
  6.                 SpreadView.Sheets[SpreadView.ActiveSheetIndex].SetActiveCell(0, 1);
  7.                 SpreadView.ShowActiveCell(VerticalPosition.Top, HorizontalPosition.Left);
  8.             }
  9.         }
复制代码
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部