• 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.
  • Posts

    • This feature has been useful when applying for jobs and creating/editing cover letters in seconds! Not worried MS might see the jobs I'm applying to 🤣
    • What annoys me is the people that try to buy a higher end product, and then low ball you, and say but I don't need that function, all I need is to use it for video out so I don't feel like paying higher price.   I had a person that was trying to buy RTX 3080 from me for $100 and his excuse was, well I won't be playing games on it, I just need four monitor outout. Or someone was trying to buy 2TB Gen5 M.2 for $50, well I don't need the speed, is just for basic storage. Or i was offered $80 for 20TB hard drive, that person said well, right now I only about 7TB, so rest won't be in use Just some examples in last month or two...   The guy with the 3080, I replied to with something like go to Chevy dealer and offer them $15K for that brand new corvette and tell them that you you only need to drive to work, so you don't need to go fast.   There a lot of low ballers that try to take advantage.
    • Not in Syracuse, NY. They're about to break ground! https://www.syracuse.com/micro...on-and-other-tech-jobs.html
    • Here in Finland we have lots of rural areas with narrow roads, one of the highest taxes in the world (cars are taxed way above EU standards) and fuel is quite expensive. Yet we educate our drivers to drive responsibly and safely in all areas, and our people respect each others rights and freedom to move around safely. Which is why we have even small children under 10 years old walking and cycling alone to schools in the streets, even in big cities. Safety is about being responsible and about respecting others. And I would hate to see AI (or anyone else) destroy our way of life. There are and always will be outliers, accidents happen and machines break. I dont't want to see people relying on AI to do things like driving for them. I want people to think and react to the world around them themselves, and being responsible instead of them browsing TikTok or whatever instead of looking out the window, and then saying that "It wasn't me, it was the car". Already people walk around town with their eyes glued to a screen – I don't want people driving around the same way.
    • And I should hope none will. I don't want to walk ouside to have some randome AI drive over me and mine. Not that I want a person to do it either but I want there to be an actual person who takes responsibility of their actions instead of relinquishing control to a machine. In some highways I can accept self-driving, but even then there should be some kind of dead man switch etc. that actually monitors the drivers status.
  • Recent Achievements

    • One Month Later
      POR2GAL4EVER earned a badge
      One Month Later
    • One Year In
      Orpheus13 earned a badge
      One Year In
    • One Month Later
      Orpheus13 earned a badge
      One Month Later
    • Week One Done
      Orpheus13 earned a badge
      Week One Done
    • Week One Done
      serfegyed earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      536
    2. 2
      ATLien_0
      248
    3. 3
      +FloatingFatMan
      177
    4. 4
      +Edouard
      166
    5. 5
      Xenon
      118
  • Tell a friend

    Love Neowin? Tell a friend!