• 0

[vb .net] Flicker in rich text box?


Question

19 answers to this question

Recommended Posts

  • 0

Hmmm try this, i can't see if it works because it doesn't flicker over here for me.

But make a new class file

paste this in it:

Public Class DoubleBufferRichTextBox

    Inherits System.Windows.Forms.RichTextBox

    Public Sub New()
        SetStyle(ControlStyles.DoubleBuffer, True)
        SetStyle(ControlStyles.AllPaintingInWmPaint, True)
    End Sub
    Public Event CustomPaint(ByVal e As PaintEventArgs)

    Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)

        RaiseEvent CustomPaint(e)

    End Sub

End Class

I'm not sure if it would work, because someone helped me out once with this, because my gradients inside a panel was flickering on resize, but Double Buffering had fixed this issue, not sure if it would work on Textboxes.

So once you've made that class above

go into the form where the actual RichTextBox control works

and where the Windows Form Generated Code is

look for where the RichTextBox is instantiated

i.e. should be something like

richTextBox = new System.Windows.Forms.RichTextBox

and just change it to

richTextBox = new DoubleBufferRichTextBox

  • 0
  bangbang023 said:
well I do but even when I disable it, still the same thing. I actually created a vanialla blank app with a rich text box and the same thing happens.

584840882[/snapback]

This may sound dumb but, are you using a custom visual style?

I don't know because it seems like it's only happening to you, you can't eliminate the possibilities which might be causing this issue, have u tried sending the exe to a friend to see if they experience the same problem?

  • 0

Hm I can also see the flicker.. probably because I have a crap video card :p (It's only noticable when theres a large amount of text though).. I'll have a look and see if I can find a solution :p

Dan

EDIT: I took a look and it doesnt seem as though you can do much about this as the framework isnt actually drawing the richtextbox. :(.. I guess if the flickering is that big a problem then you will have to go back to the TextBox. :) (Hopfully I'm wrong :p)

Edited by dannyres
  • 0

Sorry, but most versions of RichEdit simply flicker. It's a poorly written control and the MS coders were too lazy to properly use a back buffer. It has nothing to do with monitor, video card, or refresh rate.

The only thing I can suggest is messing with the window styles for the parent window and the rich edit window itself.

WS_CLIPCHILDREN for the parent and WS_CLIPSIBLINGS for the rich edit.

As well, CS_HREDRAW and CS_VREDRAW should not be classed as class styles for RegisterClassEx.

Edited by vcv
  • 0
  vcv said:
Sorry, but most versions of RichEdit simply flicker.  It's a poorly written control and the MS coders were too lazy to properly use a back buffer.  It has nothing to do with monitor, video card, or refresh rate.

The only thing I can suggest is messing with the window styles for the parent window and the rich edit window itself.

WS_CLIPCHILDREN for the parent and WS_CLIPSIBLINGS for the rich edit.

As well, CS_HREDRAW and CS_VREDRAW should not be classed as class styles for RegisterClassEx.

584844295[/snapback]

I figured it had to be the control after all. Thanks.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.