FYI : Preventing flicker

BlitzPlus Forums/BlitzPlus Programming/FYI : Preventing flicker

I've seen the question asked a couple of times and didn't see an anwser. So in case anyone else needs to solve the problem of flicker when certain actions are taken on a panel such as recreating a canvas. Use the Win32 API function LockWindowUpdate()

;;;;
;.lib "user32.dll"
;LockWindowUpdate(hWnd%) : "LockWindowUpdate"
;;;;

; Locking window to prevent the flicker
LockWindowUpdate(QueryObject(drawPanel, 1))
FreeGadget canvas
canvas = CreateCanvas (0, 0, 200, 200, drawPanel)
SetGadgetLayout canvas,0,0,0,0
LockWindowUpdate(0) ; Make sure to unlock the window

Ken Carlino

www.pixarra.com

good tip.

Yeah, good tip. We use this in our VB6 and VB.NET apps too, and it's removed the horrible redraw flicker completely.

Cool. I'm using it too, looks much better. Thanks!