FYI : Preventing flicker

BlitzPlus Forums/BlitzPlus Programming/FYI : Preventing flicker

Kcarlino(Posted 2003) [#1]
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


Kanati(Posted 2003) [#2]
good tip.


Murilo(Posted 2003) [#3]
Yeah, good tip. We use this in our VB6 and VB.NET apps too, and it's removed the horrible redraw flicker completely.


Wiebo(Posted 2003) [#4]
Cool. I'm using it too, looks much better. Thanks!