由于要判断 cell 是否已锁定,如已锁定的话则不能更改里面的公式,但如用 columns(3) 作全栏设定时, 则 entercell 里的 ActiveSheet.ActiveCell.Locked = True 会有问题, 但用 cell 作 locked 时,则正常. 用 spread 5 及 6 都有此问题. 有何方式解决?
我用的是 win.forms 版本, vb.net 2008, 以下为程序码
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
FpSpreadSAM_Sheet1.Columns(3).Formula = "A1*B1"
FpSpreadSAM_Sheet1.Columns(3).Locked = True
FpSpreadSAM_Sheet1.Cells(0, 3).Locked = True
End Sub
Private Sub FpSpreadSAM_EnterCell(ByVal sender As System.Object, ByVal e As FarPoint.Win.Spread.EnterCellEventArgs) Handles FpSpreadSAM.EnterCell
If FpSpreadSAM.ActiveSheet.ActiveCell.Locked = True Then
Me.FormulaTextBox1.Enabled = False
Else
Me.FormulaTextBox1.Enabled = True
End If
End Sub
End Class |
|