OTveit
asked on
Flicker free picturebox
I have a PictureBox wich I draw different objects in, using the Line, PSet and Circle method. I move these objects around by clearing the entire PictureBox and redrawing them in a different position. The PictureBox also contains a background (Gridlines) which are not moved. The problem is that this method makes the objects flicker. Is there a smarter way to do this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The LockWindowUpdate works ok for my PictureBox - it does not flicker. But erverything else does, both in my application and the entire Windows environment.......????
Can you post the code here so we can take a look?
ASKER
Ooops... ! During cutting and pasting to post the code here I noticed that I had a PictureBox1.Cls command outside the LockWindowUpdate. Moving it between the LockWindowUpdate PictureBox1.hWnd and LockWindowUpdate 0 made the flickering dissapear....
Thanks!
Thanks!
Once you've finished drawing your objects on the picture box, call LockWindowUpdate, but with a 0 (zero) in place of the control handle, and the picture box will be redrawn with all your changes.