回复 6楼yrpting的帖子
yrpting 你好,
请尝试以下代码:
- Dim preRow As Integer
- Dim preCol As Integer
- Private Sub FpSpread1_EditModeOff(ByVal sender As Object, ByVal e As System.EventArgs) Handles FpSpread1.EditModeOff
- '将总额-账户1-账户2-账户3赋值给剩余
- Me.FpSpread1.ActiveSheet.Cells(Me.FpSpread1.ActiveSheet.ActiveRowIndex, 3).Text = _
- CDec(Me.FpSpread1.ActiveSheet.Cells(Me.FpSpread1.ActiveSheet.ActiveRowIndex, 0).Value) - _
- CDec(Me.FpSpread1.ActiveSheet.Cells(Me.FpSpread1.ActiveSheet.ActiveRowIndex, 1).Value) - _
- CDec(Me.FpSpread1.ActiveSheet.Cells(Me.FpSpread1.ActiveSheet.ActiveRowIndex, 2).Value)
- preRow = Me.FpSpread1.ActiveSheet.ActiveCell.Row.Index
- preCol = Me.FpSpread1.ActiveSheet.ActiveCell.Column.Index
- End Sub
-
- Private Sub FpSpread1_EditModeOn(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FpSpread1.EditModeOn
-
- End Sub
- Private Sub FpSpread1_CellClick(ByVal sender As System.Object, ByVal e As FarPoint.Win.Spread.CellClickEventArgs) Handles FpSpread1.CellClick
- If e.Row <> preRow Then
- If Me.FpSpread1.ActiveSheet.Cells(preRow, 3).Text <> "0" Then
- e.Cancel = True
- End If
- End If
- End Sub
- End Class
复制代码 |