Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/articles/mfc-tutorials/)
-   -   Display Bitmap in a Picture Box using MFC from a file (http://www.go4expert.com/articles/display-bitmap-picture-box-using-mfc-t350/)

Tajin 9Nov2007 14:11

Re: Display Bitmap in a Picture Box using MFC from a file
 
Shabbir,
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 9Nov2007 15:46

Re: Display Bitmap in a Picture Box using MFC from a file
 
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 6Mar2008 14:47

Re: Display Bitmap in a Picture Box using MFC from a file
 
i m always confused with files but thanksyour explanation and code was good

pandyajayn 8May2008 17:44

Re: Display Bitmap in a Picture Box using MFC from a file
 
Hi, I am getting error during calling Invalidate() in the given file so please provide me the solution.

mcbals 12Sep2008 11:33

Re: Display Bitmap in a Picture Box using MFC from a file
 
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.

thanks.

ramrao 31Aug2010 10:18

Re: Display Bitmap in a Picture Box using MFC from a file
 
ok thank you.....

Black Betty 28Sep2010 20:05

Re: Display Bitmap in a Picture Box using MFC from a file
 
Wondering if you ever got round to doing JPG sample.
Thanks


All times are GMT +5.5. The time now is 01:08.