实现方法类似,请参考以下代码:- 'FpSpread1和FpSpread2都是 5行 3列
- Private Sub FpSpread1_PreviewKeyDown(sender As System.Object, e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles FpSpread1.PreviewKeyDown
- If e.KeyCode = Keys.Tab AndAlso
- FpSpread1.ActiveSheet.ActiveRowIndex = 4 AndAlso
- FpSpread1.ActiveSheet.ActiveColumnIndex = 2 Then
- FpSpread2.Focus()
- FpSpread2.ActiveSheet.ActiveColumnIndex = 0
- FpSpread2.ActiveSheet.ActiveRowIndex = 0
- End If
- End Sub
- Private Sub FpSpread2_PreviewKeyDown(sender As System.Object, e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles FpSpread2.PreviewKeyDown
- If e.Shift AndAlso e.KeyCode = Keys.Enter AndAlso
- FpSpread1.ActiveSheet.ActiveRowIndex = 4 AndAlso
- FpSpread1.ActiveSheet.ActiveColumnIndex = 2 Then
- FpSpread1.Focus()
- FpSpread1.ActiveSheet.ActiveColumnIndex = 2
- FpSpread1.ActiveSheet.ActiveRowIndex = 4
- End If
- End Sub
复制代码 |