找回密码
 立即注册

QQ登录

只需一步,快速开始

WangQingwei

注册会员

4

主题

5

帖子

40

积分

注册会员

积分
40

活字格认证

最新发帖
WangQingwei
注册会员   /  发表于:2010-1-15 11:58  /   查看:8486  /  回复:2
我的Spread中,有6列,只有第4列可以编辑。我想实现的是:
在Cell(0,4)中按下Enter时,光标跳到Cell(1,4),同时对Cell(0,4)进行Format。
以此类推。

版本信息:
SPREAD for .NET 3.0J Windows Forms Edition リリースノート
Version 3.0.2010.2005

2 个回复

倒序浏览
山水
初级会员   /  发表于:2010-1-15 19:22:00
沙发
这位先生,您好!
您可以用下面一段代码实现当按下回车键时,active cell跳到下一行:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim im As New FarPoint.Win.Spread.InputMap
'Define the operation of pressing Enter key in cells not being edited as "Move to the next row".
im = FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused)
im.Put(New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow)
'Define the operation of pressing Enter key in cells being edited as "Move to the next row".
im = FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused)
im.Put(New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow)
End Sub
为了对Cell(0,4)进行Format,您可以使用FpSpread的EnterCell事件,在其事件处理器中对之处理;
您还可以设置FpSpread的EditModePermanent属性到True,使active cell 始终进入编辑状态。
一切顺利!
回复 使用道具 举报
WangQingwei
注册会员   /  发表于:2010-1-18 14:59:00
板凳
谢谢版主的回答!
这个方法我也试过,有个问题是,当光标到达最后一行时光标就无法移动出来。
而我们需要在光标离开时计算一个合计值,这样的话光标在最后一行的时候就没办法计算了。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部