2

I am fully aware that this is an issue asked many times but I have not found a perfect solution.

Problem: I have a simple Windows Form with a few table panels, a text area, and a text label that serves as a character counter - Very innocent setup. However, when I start updating that character counter text label, my entire form flickers (i.e. flashes white) for each character I enter into one of the text areas.

The most common solutions I've read about are to play around with various buffering and rendering parameters. I've tinkered with invalidation, the double buffering parameter, the series of ControlStyle parameters, as well as some other even strange ways of forcing double-buffering.

Of all these solution, only 2 appear to have a noticeable improvement. However, if I just hold my finger onto a key, the flicker still occurs eventually. So what I am looking for is an even better solution that removes the flicker entirely. Since character counter is a rudimentary concept, I am sure it is a well-visited area with known solutions.

Community
  • 1
  • 1
user1836155
  • 858
  • 14
  • 29
  • 3
    Can you post the code you have so far? – Jon B Nov 29 '12 at 15:30
  • are you using a background image in the panel? – urlreader Nov 29 '12 at 15:32
  • How are you updating the label? Are you using a BGWorker at all? – JWiley Nov 29 '12 at 19:25
  • swtich to WPF applications ... win forms will flicker .. Double buffering and other things for win forms will not gonna help! ITs a truth accept it. Its basically because of images. if you are using images, use bitmaps format! – Sunny Dec 01 '12 at 06:42
  • No, I am not using background image. And no, I can't post the code because it's private stuff under NDA. I update the label by simply changing its text attribute. And no, I can't switch to WPF because it's not my personal project – user1836155 Dec 04 '12 at 23:47
  • TableLayout is stupid. Maybe try put this label on Panels (with double buffering). Or try to put Panel onto TableLayout, then label on Panel. – apocalypse Feb 14 '13 at 01:31
  • i see this all the time, ive been wandering what a solutution would be. got me wandering though, have you tried putting your character count update function on a thread? wandering if that will help, when i update my timer nothing flashes on my form, i guessed it had something to do with it being on a thread. So give it a try. – lemunk Apr 17 '13 at 11:26

1 Answers1

0

In times where I need help, I alter my code to hide the private details contained therein.

If this is not a possibility, I would suggest the following to lessen the flickering:

Use a timer between keystrokes (register the keyup event). If a keyup event has not occurred in 500 ms, allow the textchanged event to proceed, else, do nothing.

JDennis
  • 672
  • 6
  • 15