VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Change Color Of a Piece Of String In RichTextBox Without Flashing In It

by Abdalla Mahmoud (10 Submissions)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (5 Votes)

Hi All .. This Function Solve Problm Of Flashing During Change the Color of a Piece of String in RichTextBox .. It's Useful For CodeBoxes ..

Rate Change Color Of a Piece Of String In RichTextBox Without Flashing In It

Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
Function ColorRtfString(ByVal SelStart As String, ByVal SelLength As Long, ByVal Color As Long)
Dim OldPos As Long
Call LockWindowUpdate(RichTextBox.hWnd)
'Locking Editing (It Ignores Flashing )
OldPos = RichTextBox.SelStart
RichTextBox1.SelStart = SelStart
RichTextBox1.SelLength = SelLength
RichTextBox1.SelColor = Color
RichTextBox1.SelStart = OldPos
RichTextBox1.SelLength = 0
'Unlocking Editing 
Call LockWindowUpdate(0)
End Function

Download this snippet    Add to My Saved Code

Change Color Of a Piece Of String In RichTextBox Without Flashing In It Comments

No comments have been posted about Change Color Of a Piece Of String In RichTextBox Without Flashing In It. Why not be the first to post a comment about Change Color Of a Piece Of String In RichTextBox Without Flashing In It.

Post your comment

Subject:
Message:
0/1000 characters