-piccola modifica allo script

This commit is contained in:
Demetrio Cassarino
2025-02-26 14:55:09 +01:00
parent 2023a6217d
commit 7d1b2004d9
6 changed files with 103 additions and 7 deletions
+20 -1
View File
@@ -22,7 +22,8 @@
End Sub
Private Sub sNameFile_RichTxBx_TextChanged(sender As Object, e As TextChangedEventArgs)
If Not IsNothing(Map.refScriptWindowVM) Then Map.refScriptWindowVM.ChangeTextColor()
'If Not IsNothing(Map.refScriptWindowVM) Then Map.refScriptWindowVM.ChangeTextColor()
If Not IsNothing(Map.refScriptWindowVM) Then Map.refScriptWindowVM.SyntaxHighlighting(sNameFile_RichTxBx)
End Sub
Private Sub sNameFile_RichTxBx_SelectionChanged(sender As Object, e As RoutedEventArgs)
@@ -33,9 +34,27 @@
If e.Key = Key.Enter Then
Map.refScriptWindowVM.InsertText(sNameFile_RichTxBx, vbCrLf)
e.Handled = True
ElseIf e.Key = Key.Tab Then
e.Handled = True
' Ottieni la posizione corrente del cursore
Dim caretPosition As TextPointer = sNameFile_RichTxBx.CaretPosition
' Inserisci un carattere di tabulazione (3 spazi)
Dim tabString As String = " "
Dim run As New Run(tabString)
Dim textRange As New TextRange(caretPosition, caretPosition)
textRange.Text = tabString
' Aggiorna la posizione del cursore
sNameFile_RichTxBx.CaretPosition = textRange.End
End If
End Sub
Private Sub sNameFile_RichTxBx_PreviewMouseWheel(sender As Object, e As MouseWheelEventArgs)
' Ottieni il numero di righe da scorrere
Dim linesToScroll As Integer = e.Delta / 5
' Scorri il contenuto della RichTextBox
sNameFile_RichTxBx.ScrollToVerticalOffset(sNameFile_RichTxBx.VerticalOffset - linesToScroll)
End Sub
#End Region ' Events
End Class