Tajin's Avatar, Join Date: Sep 2007
Newbie Member
I'm new to code in VC++. Please verify my code according to your suggestion.

1.Add a picture Box to your application

Is it ok?
CPictureBox pic;

How can I do the following?

3. Add a variable to the picture box. By default it will be CStatic. I call it picPreview
4. Change the CStatic to CPictureBox. Don't forget to add the header files at the top.

Please Help!!
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
If you are using the MFC Wizard you will need to use the Class wizard to add the variable or else you should be adding the variable in dialog class and the DDX of the control into the message maps and then you are done.

Now when you have the variable in the header file you will need to change it type from CStatic to CPictureBox.
parvez.yu's Avatar, Join Date: Feb 2008
Ambitious contributor
i m always confused with files but thanksyour explanation and code was good
pandyajayn's Avatar, Join Date: May 2008
Newbie Member
Hi, I am getting error during calling Invalidate() in the given file so please provide me the solution.
mcbals's Avatar, Join Date: Jun 2008
Newbie Member
Hi, i got an error on this line of code:
m_statPic.Create("", WS_CHILD|WS_VISIBLE|SS_BITMAP|SS_CENTERIMAGE, rectBackGrnd ,this);

m_statPic is a Control variable for text control.
This line works on a single window mfc, but when tried on a child window it is erroneus.

please need some advice.

ramrao's Avatar, Join Date: Aug 2010
Newbie Member
ok thank you.....
Black Betty's Avatar, Join Date: Sep 2010
Newbie Member
Wondering if you ever got round to doing JPG sample.