其实就是以下的CellChanged事件,如果表格里没有隐藏的列就能正常的自动一行一行的增加,如果有隐藏的列,那就只能增加表格中原本已经有的行的数量
Private Sub FpSpread1_Sheet1_CellChanged(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.SheetViewEventArgs) Handles FpSpread1_Sheet1.CellChanged
If e.Column = 0 Then
Dim TxtStr As String = Me.FpSpread1_Sheet1.Cells(e.Row, e.Column).Text
If TxtStr <> "" AndAlso e.Row = Me.FpSpread1_Sheet1.Rows.Count - 1 Then
Me.FpSpread1_Sheet1.Rows.Add(Me.FpSpread1_Sheet1.Rows.Count, 1)
End If
End If
End Sub
还有窗体初始化的时候加了自定义按键操作
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim im As New FarPoint.Win.Spread.InputMap
im = Me.FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused)
im.Put(New FarPoint.Win.Spread.Keystroke(Keys.C, Keys.Control),FarPoint.Win.Spread.SpreadActions.ClipboardCopyAsStringSkipHidden)
im.Put(New FarPoint.Win.Spread.Keystroke(Keys.V, Keys.Control),FarPoint.Win.Spread.SpreadActions.ClipboardPasteAsStringSkipHidden)
im = Me.FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused)
im.Put(New FarPoint.Win.Spread.Keystroke(Keys.C, Keys.Control),FarPoint.Win.Spread.SpreadActions.ClipboardCopyAsStringSkipHidden)
im.Put(New FarPoint.Win.Spread.Keystroke(Keys.V, Keys.Control),FarPoint.Win.Spread.SpreadActions.ClipboardPasteAsStringSkipHidden)
End Sub |