Search code examples
windowswinapilayoutwindow-managerswindow-resize

How to avoid transient updates in a GUI resize?


If you drag the top or left border of a window semi-quickly, you should notice that the opposite edge of the window vibrates -- it gets dragged, but then re-adjusts to increase the size.

The problem is a lot worse when you have items that dynamically resize -- then a bunch of your controls start sliding and resizing on the screen, quite visibly.

Is there any way to prevent these transient effects?

e.g. Perhaps a particular sequence of responding to messages like WM_SIZE can suppress this? I don't know.

(It seems to happen in every framework I've seen, even plain Win32. Just open up Explorer or something and drag its top or left edge, and you'll see what I mean.)


Solution

  • Respond to the WM_WINDOWPOSCHANGING message and set the SWP_NOCOPYBITS flag in the flags member of the WINDOWPOS structure.