• 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

    • I don't expect to see 12 this year, but not for this reason. Windows 10 got a 21H2 update the year Windows 11 came out, it even got 22H2 the next yet.
    • Android 16 adds a new "network notification" setting that warns you when a rogue "stingray" device is trying to spy on you There are many simple things you can do to keep your private information safe, like using strong passwords, scrutinizing app permissions, and only installing apps from trusted sources. However, some attacks are much harder to protect yourself against, as they’re so sophisticated and stealthy that they can happen without you ever noticing. One such attack tricks your phone into connecting to a fake, insecure mobile network, which is difficult for the average person to detect. Fortunately, the new Android 16 update has a feature that can warn you when someone is using this tactic to snoop on you. This type of attack uses a device called a “stingray.” An attacker sets up this device near a target they want to surveil, and it mimics a legitimate cell tower. The stingray tricks nearby mobile devices into connecting to it, allowing the attacker to collect unique identifiers (like the IMEI) and even force them onto an older, more insecure communication protocol. These identifiers allow attackers to target specific devices for analysis, while switching protocols can let them intercept unencrypted text messages and phone calls. https://www.androidauthority.com/android-16-mobile-network-security-3571497/
    • It's worse in Canary this week. When you type something in the address bar and press enter, most cases it defaults to "Ask copilot" that shoves whatever you wrote into copilot. Then you have to retype whatever you wanted and use the down arrow or mouse to select your search engine instead of copilot. Each version that has this behavior(that can't be turned off in settings yet) I'm sending feedback in hoping they don't do this into other channels.
    • Oh wow i really didn't know about this! 😳 Could you tell where they're available even if not public?
  • Recent Achievements

    • Week One Done
      emptyother earned a badge
      Week One Done
    • Week One Done
      DarkWun earned a badge
      Week One Done
    • Very Popular
      valkyr09 earned a badge
      Very Popular
    • Week One Done
      suprememobiles earned a badge
      Week One Done
    • Week One Done
      Marites earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      567
    2. 2
      ATLien_0
      178
    3. 3
      +FloatingFatMan
      178
    4. 4
      Xenon
      120
    5. 5
      Som
      112
  • Tell a friend

    Love Neowin? Tell a friend!