Zaxxon
October 17, 2007, 15:18:55
It would be cool, if the Table-Objects could have a property, that if the cursor is in the cell of the last row and the last column and the tab-key is pressed, a new tablerow is going to be inserted automaticly after the current tablerow.
@Gunnar
Yes, i know, i can make it possible with some little own code ;) (and i'm still doing it) but i think it would be a cool feature.
...
Private Sub _texteditor_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles _textcontrol.KeyDown
If e.KeyCode = Keys.Tab AndAlso Not e.Shift AndAlso Me.EinfuegemarkeIstInTabelle = True Then
'Fügt eine neue Tabellenzeile ein, wenn sich der Cursor beim drücken der Tabulatortaste
'in der letzten Zelle einer Tabelle befunden hat
Dim alteeinfuegeposition As Integer = _textcontrol.InputPosition.TextPosition
If _textcontrol.Tables.GetItem.Cells.GetItem.Column = _textcontrol.Tables.GetItem.Columns.Count _
AndAlso _textcontrol.Tables.GetItem.Cells.GetItem.Row = _textcontrol.Tables.GetItem.Rows.Count Then
Me.FuegeZeileDahinterEin()
_textcontrol.InputPosition = New TXTextControl.InputPosition(alteeinfuegeposition)
End If
End If
End Sub
Friend Function EinfuegemarkeIstInTabelle() As Boolean
Dim result As Boolean
If Not _textcontrol.Tables.GetItem Is Nothing Then
result = True
Else
result = False
End If
Return result
End Function
Friend Function FuegeZeileDahinterEin() As Boolean
Dim result As Boolean
Try
'Es wird eine Zeile nach der aktuellen Zeile eingefügt
_textcontrol.Tables.GetItem.Rows.Add(TableAddPosit ion.After, 1)
result = True
Catch ex As Exception
result = False
End Try
Return result
End Function
...
@Gunnar
Yes, i know, i can make it possible with some little own code ;) (and i'm still doing it) but i think it would be a cool feature.
...
Private Sub _texteditor_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles _textcontrol.KeyDown
If e.KeyCode = Keys.Tab AndAlso Not e.Shift AndAlso Me.EinfuegemarkeIstInTabelle = True Then
'Fügt eine neue Tabellenzeile ein, wenn sich der Cursor beim drücken der Tabulatortaste
'in der letzten Zelle einer Tabelle befunden hat
Dim alteeinfuegeposition As Integer = _textcontrol.InputPosition.TextPosition
If _textcontrol.Tables.GetItem.Cells.GetItem.Column = _textcontrol.Tables.GetItem.Columns.Count _
AndAlso _textcontrol.Tables.GetItem.Cells.GetItem.Row = _textcontrol.Tables.GetItem.Rows.Count Then
Me.FuegeZeileDahinterEin()
_textcontrol.InputPosition = New TXTextControl.InputPosition(alteeinfuegeposition)
End If
End If
End Sub
Friend Function EinfuegemarkeIstInTabelle() As Boolean
Dim result As Boolean
If Not _textcontrol.Tables.GetItem Is Nothing Then
result = True
Else
result = False
End If
Return result
End Function
Friend Function FuegeZeileDahinterEin() As Boolean
Dim result As Boolean
Try
'Es wird eine Zeile nach der aktuellen Zeile eingefügt
_textcontrol.Tables.GetItem.Rows.Add(TableAddPosit ion.After, 1)
result = True
Catch ex As Exception
result = False
End Try
Return result
End Function
...