[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 618
  • Last Modified:

How do I display bitmaps on a CStatic during execution?

I have several bitmaps that I want to show up in my CStatic object, one at a time, depending on the state of the application. I am setting the bitmap up with the following code:

   CBitmap* theBitmap = new CBitmap();

This does *something*, you see a blank white box show up.  What am I doing wrong?  The picture doesn't show up.

Also, in the resource editor I load one bitmap onto the CStatic to start out with (and to be changed during execution).  When I test the dialog in resource editor it shows up, but not when I run the program.
1 Solution
1. Make sure the static control has the SS_BITMAP style.
2. Don't delete the theBitmap object until the static control is destroyed.
3. Check the return value of LoadBitmap.
4. Try
applebyAuthor Commented:
Thank you!  I figured it was some kind of redrawing I was missing.  That did it.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now