0

I have a Winforms program with lots of controls in the main window.

When I minimize the program by pressing the minimize button, and then bring it back by clicking the program in the taskbar, it takes a while to redraw all the controls. This gets worse the more controls there are. For example, something like this hypothetical example takes a full second to redraw its contents.

However, if one simply clicks another program's icon (say Google Chrome), and returns to the original Winforms program, the refresh is instant. There's no slow redrawing of controls.

Is there a way to somehow get Windows to 'remember' the window's contents so that minimizing and reshowing the window is instant?

Dan W
  • 3,520
  • 7
  • 42
  • 69
  • 1
    Does your form have the `DoubleBuffered` property set to `true`? – Blorgbeard Jul 04 '16 at 01:29
  • Tried it now. Doesn't help. – Dan W Jul 04 '16 at 01:52
  • Hmm. Here's some recommended reading that might help: http://stackoverflow.com/questions/2612487/how-to-fix-the-flickering-in-user-controls – Blorgbeard Jul 04 '16 at 01:57
  • In the examle the Form doesn't need to be redrawn because the system kept a screenshot of it and the form itself was not __active__ ; you could try to do that and hide the redrawing (which would be happening behind the scenes) by taking a screenshot of the form, and overlaying it for a short period of time after the restoring; but that would be a crazy workaround. I doubt it could even work as your form was active when you minimzed it.. – TaW Jul 04 '16 at 07:13
  • - Winforms Controls are slow, unless they are __all__ double-buffered, but most can't be (easily). __You simply are not supposed to have so many controls__ If you show us the form, we might give more specific advice. - But maybe there is a system flag one can set or reset to mark it as not-dirty? @Hans to the rescue.. – TaW Jul 04 '16 at 07:16
  • @Blorgbeard: Thanks, I tried some of the various solutions proposed in that link, but at best, flickering is disquised in some way, and the redrawing of controls is still slow. – Dan W Jul 04 '16 at 15:22
  • @TaW: To be honest, taking a screenshot of the window may be a workable solution for my case. An automated way of double buffering all controls would be ideal, but I think Blorgbeard's link had an answer that said that, but it doesn't help much for me. – Dan W Jul 04 '16 at 15:25

0 Answers0