You don't need to override the OnPaint event, instead you need to override
WndProc, as listed below.
The Object Private Variable __Paint is a flag that indicates if it's
allowed to paint or not. When you're seting the colors using
SelectionColor you set __Paint to false. When you're done back to true.
[]'s
MstrControl
PS.: I've done the coloring code also.. but my problem is performance. I'm
trying to raise the coloring to a multithreaded environment, but so far
I'm out of luck. Does anyone can help?
--- Start of the code ---
''' <summary>
''' (Protected)
''' Controls the paint event of the base control.
''' </summary>
''' <param name="m">Windows Message to be processed</param>
Protected Overrides Sub WndProc_
(ByRef m As System.Windows.Forms.Message)
'*
'* Check if it's a WM_PAINT message
'*
If (m.Msg = WM_PAINT) Then
'*
'* Can we Paint?
'*
If (__Paint) Then
'*
'* Ok Let's go
'*
MyBase.WndProc(m)
Else
'*
'* Oops...
'*
m.Result = IntPtr.Zero
End If
Else
'*
'* It's something else...
'*
MyBase.WndProc(m)
End If
End Sub
--- End of the Code ---
On Mon, 28 Mar 2005 16:55:38 +0000, Tony Hal <[EMAIL PROTECTED]> wrote:
>I read about the double buffering approach, but I am not sure how this can
>be done in the context of richtextbuffer. RichTextbuffer does not give me
>the direct access to its internal buffer. You can only make changes to its
>internal buffer indirectly via the Text and SelectionColor properties,
and
>this will result in re-painting immediately which is not I want to do.
>If anyone thinks this is possible to do, please let me know.
>
>
>>From: Jamin Guy <[EMAIL PROTECTED]>
>>To: [email protected], Tony Hal
>><[EMAIL PROTECTED]>
>>Subject: Re: Flicker problem in richtextbox
>>Date: Sun, 27 Mar 2005 01:30:21 -0500
>>
>>Have you checked out double-buffering?
>>
>>http://www.codeproject.com/cs/media/flickerFreeDrawing.asp
>
>===================================
>This list is hosted by DevelopMentor� http://www.develop.com
>
>View archives and manage your subscription(s) at
http://discuss.develop.com
===================================
This list is hosted by DevelopMentor� http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com