Search Tools Links Login

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


Visual Basic 6, or VB Classic

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

Original Author: Abdalla Mahmoud

Code

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

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 189 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.