Jump to content
  • Advertisement
Sign in to follow this  
Daubster

Saving drawn objects

This topic is 4089 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

Hey, I've been trying to make a very simple tic-tac-toe interface in an MFC dialog recently.. I'm drawing the shapes with a CClientDC object. No problems with that. Though minimizing/resizing the window makes all the shapes disappear. Now I know, that you need to draw on a bitmap to fix this, though I have no idea how to do that. Any help?

Share this post


Link to post
Share on other sites
Advertisement
Drawing the shapes to a bitmap isn't neccesarily the only solution.

I don't know anything about MFC, but in normal Win32 stuff, you'd just need to store enough information to redraw the shapes (i.e. position and so on) and redraw them whenever you get a WM_PAINT message. That will solve the minimizing and maximizing issue. I'd suspect you lose your images if you drag another window over your window then away again.

I assume MFC provides a virtual function or something you can use to respond to WM_PAINT under the hood.

Share this post


Link to post
Share on other sites
Quote:
Original post by EasilyConfusedI assume MFC provides a virtual function or something you can use to respond to WM_PAINT under the hood.

Yep; just override OnPaint() in your CDialog-derived class, and create a CPaintDC in that method to do your drawing. Then all your drawing code will be run every time the window is invalidated.

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!