Jump to content
  • Advertisement
Sign in to follow this  
GetWindowRect

Alternative to InvalidateRect to update window

This topic is 4834 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have put an image onto a window, and when it resizes I resize the image with the window. If I do not use InvalidateRect the main image stays on top of the other images loaded and looks like the effect you get when resizing a program that stopped responding so to speak. If I use InvalidateRect the image flickers a lot and looks terrible anyway. Is there anyway to stop the flicker, or make it less visible anyway? Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
I'm guessing you are passing TRUE for the third parameter of InvalidateRect, and that you are calling BeginPaint in your WM_PAINT handler, and finally that you do not have a handler for WM_ERASEBKGND. Thus your client area gets erased before you get a chance to redraw it and you have a noticable flicker.

Share this post


Link to post
Share on other sites
Quote:
I'm guessing you are passing TRUE for the third parameter of InvalidateRect, and that you are calling BeginPaint in your WM_PAINT handler, and finally that you do not have a handler for WM_ERASEBKGND. Thus your client area gets erased before you get a chance to redraw it and you have a noticable flicker.


I am passing true as the third parameter to InvalidateRect, however I am handling the image loading in the WM_ERASEBKGND message, and using GetDC(). I did however find out the problem, it was a stupid mistake on my part. The function I was using to display the image is in my Window wrapper class. In the WM_ERASEBKGND message I paint the window with the background color chosen, which is why I was getting such a noticable flicker. I changed my method to not call the coloring of the window if an image is to be loaded and it seems to work a lot better.

Thank you for your replies.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!