I'm creating a small maki script editor with color coding, and for some reason the richtextbox flickers. I have been reading on the internet that I should be using TX Classes to group actions and preform them on .net, Yet I've no idea what TX classes are....
Previous solutions were to use the LockWindowUpdate API, but this also didn't work, infact I can't even get that API to work properly on VB.net because the handle returned is a pointer and not an integer.... but I didn't play with it much though. Heres my code:
I understand this code is rather simple and inefficient because you could do less loops going line by line doing a type of split(text, " "), but right now I want to try and get the flicker out using this bogged down code, because the other three methods I also know of have caused flickering as well. Anyone have a method they use to stop flickering in rich text boxes?
Previous solutions were to use the LockWindowUpdate API, but this also didn't work, infact I can't even get that API to work properly on VB.net because the handle returned is a pointer and not an integer.... but I didn't play with it much though. Heres my code:
Code:
Private Sub richtxt_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles richtxt.KeyUp
Dim i As Integer
For i = 0 To 10 Step 1
If (richtxt.Find(Keys(i).Value) = -1) Then
richtxt.SelectionColor = System.Drawing.Color.Black
Else
richtxt.SelectionStart = richtxt.Find(Keys(i).Value)
richtxt.SelectionLength = Len(Keys(i).Value)
richtxt.SelectionColor = System.Drawing.Color.Blue
richtxt.SelectionStart = Len(richtxt.Text)
richtxt.SelectionLength = 0
richtxt.SelectionColor = System.Drawing.Color.Black
End If
Next
End Sub
I understand this code is rather simple and inefficient because you could do less loops going line by line doing a type of split(text, " "), but right now I want to try and get the flicker out using this bogged down code, because the other three methods I also know of have caused flickering as well. Anyone have a method they use to stop flickering in rich text boxes?