August 23rd, 2009, 08:09 PM
Help with picture box
Hello. I am trying to add to a math game (Visual C++, MFC, dialog based app) that I have developed for my daughter. Trying to make it a little more graphics based, and thus, more entertaining for her. I am having a problem. I made a simple bitmap icon in the resource editor. I have associated the picture box with the bitmap icon (under picture box properties (IDC_ANSWERICON in my program, "image" property is set to corresponding bitmap). When the program starts, the idea is to hide the picture box with the following code:
this -> GetDlgItem (IDC_ANSWERICON) -> ShowWindow (SW_HIDE); // this part works
When she correctly answers the math problem, I un-hide the picture box:
this -> GetDlgItem (IDC_ANSWERICON) -> ShowWindow (SW_SHOW); // this part does NOT work
UpdateData (FALSE); // Update the dialog
wait (2); // wait 2 seconds to allow user time to see icon
Then I hide the icon again. However, the icon never appears. Additionally I have a message box that I want to phase out. Oddly enough, if I leave the code in for the message box, the icon appears. I'm not sure what I am doing wrong. I want to take out the message box because it covers up the icon and is wholly unnecessary at this point in my daughter's educational development.
Hopefully I have included enough information in my posting. If not, please let me know. I have taken college courses in C++, but I am pretty new at Visual C++- so take it easy on me. If there is a better way to do this, I would like to know but keep in mind I am a newbie and may need it broken down a little. Thanks for all of your help. It is greatly appreciated!
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!