I’m trying to prevent flicker while resizing by ‘freezing’ the window refresh using the following code.
Public Sub AllowRedraw(extends w as Window, allow as Boolean = true)
const WM_SETREDRAW = &h000B
declare sub SendMessage lib "User32" alias "SendMessageW" (hwnd As integer, msg As integer, wParam As Boolean, lParam as Integer)
If allow then
SendMessage(w.handle, WM_SETREDRAW, True, 0)
SendMessage(w.handle, WM_SETREDRAW, false, 0)
After moving/resizing all my controls I invalidate the window using
The problem is that doing so redraws the window one control at a time causing ugly flicker. Is there a way to prevent this? The idea would by like in a canvas drawing everything to a picture and then doing only one redraw with the final image.
There is a manipulation you can do of the registry to switch Windows to the non live resizing, so you simply don’t get the ugly flicker. And you switch back to the regular user preferences after the resize.
Unfortunately, I cannot locate it at the moment. It was posted a year or so ago by Oliver Osswald.
I assume this is what you are talking about.
I’m talking more about splitters within the app. I can prevent the window from refreshing while the controls are being moved and resized. The problem is that when I’m finished and invalidate the window the whole thing redraws one control at a time causing massive flicker on a form with 20+ controls.
Neil, I appreciate the issue, if you can put up a test project of it happening I can have a play around.
You dont want to use SPI_SETDRAGFULLWINDOWS, it just looks naff.
Ok I spent about an hour gutting my project. I’ll send you a PM.