Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drawing

Status
Not open for further replies.

makaveliuk

Programmer
Dec 1, 2003
46
GB
Hi,

I am new to drawing in C++ and have written an app with a processing screen which updates a status line quite rapidly, and when I run it it flickers a lot.

On another screen I have a progress bar drawn in code which also flickers quite badly.

I am refreshing the window by using the Invalidate() function and drawing the window in the Paint() event.

Is there a way to just refresh the small part of the window that changes? Or stop it flickering?

Thanks in advance,
Dan.
 
1. If you whish to reduce fliker then you should paint at the first on a bitmap and after that to transfer the bit block on the window.
2. If you wish do draw something you should not invalidate any rect, just get the window DC and use drawing functions.
3. If you whish to refresh a small part of a window you whould use InvalidateRect(..SmallRect..) where instead of SmallRect you will specify that small window area. In this case this rect will be updated when window will receive WM_PAINT. To force receiving of that message you should sent the message WM_PAINT or to call UpdateWindow

Ion Filipski
1c.bmp
 
Thanks for the reply, I have just worked out how to create a DC in memory and double buffer the drawing functions as you mentioned and it draws perfectly with no flickering!

Cheers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top