当光标从Spread离开,点击到其他控件的时候是不触发LeaveCell事件的
思想就是用Leave事件去调用LeaveCell事件。请试一试如下代码!
Private Sub FpSpread1_LeaveCell(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.LeaveCellEventArgs) Handles FpSpread1.LeaveCell
'移動前セルの背景色をリセットします
FpSpread1.ActiveSheet.Cells(e.Row, e.Column).ResetBackColor()
'移動後セルの背景色を設定します
If Me.ActiveControl IsNot Nothing AndAlso Me.ActiveControl.Name = FpSpread1.Name Then
FpSpread1.ActiveSheet.Cells(e.NewRow, e.NewColumn).BackColor = Color.SkyBlue
End If
End Sub
Private Sub FpSpread1_Leave(sender As Object, e As EventArgs) Handles FpSpread1.Leave
Dim View As New SpreadView
With FpSpread1.ActiveSheet
FpSpread1_LeaveCell(sender, New FarPoint.Win.Spread.LeaveCellEventArgs(View, .ActiveRowIndex, .ActiveColumnIndex, .ActiveRowIndex, .ActiveColumnIndex))
End With
End Sub |