Private
Sub
GetKeyPress_NEXT()
' 定义InputMap的Option
Dim im As FarPoint.Win.Spread.InputMap
' 单元格处于编辑状态下,Enter键按下的动作
im = ssBody.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused)
' 向下一个单元格(从左到右,从上到下)移动。
im.Put( New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextColumnWrap)
' 单元格处于获得焦点的状态下,Enter键按下的动作
im = ssBody.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused)
' 向下一个单元格(从左到右,从上到下)移动。
im.Put( New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextColumnWrap)
End Sub
添加SpreadSheet的KeyPress事件
' 定义InputMap的Option
Dim im As FarPoint.Win.Spread.InputMap
' 单元格处于编辑状态下,Enter键按下的动作
im = ssBody.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused)
' 向下一个单元格(从左到右,从上到下)移动。
im.Put( New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextColumnWrap)
' 单元格处于获得焦点的状态下,Enter键按下的动作
im = ssBody.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused)
' 向下一个单元格(从左到右,从上到下)移动。
im.Put( New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextColumnWrap)
End Sub
Private
Sub
ssBody_KeyPress(
ByVal
sender
As
Object
,
ByVal
e
As
System.Windows.Forms.KeyPressEventArgs)
Handles
ssBody.KeyPress
If e.KeyChar = ChrW (Keys.Enter) Then
GetKeyPress_NEXT()
End If
End Sub
If e.KeyChar = ChrW (Keys.Enter) Then
GetKeyPress_NEXT()
End If
End Sub
注意:要用如下方法取当前列
Dim
aActiveCol
As
Integer
Dim aCol As Integer = ssBody.ActiveSheet.ActiveColumnIndex
aActiveCol = aCol - 1
Dim aCol As Integer = ssBody.ActiveSheet.ActiveColumnIndex
aActiveCol = aCol - 1