Another thing i want to ask is as you wrote to change the Cstatic type to CPicture, but i dont know how to do that? please tell me how to change the variable type from CStatic to CPicture? Thanks, Nishant
I would request you to put queries into a seperate thread rather than jumping into an old thread with the queries.
I will create the new post for my main query but just replying here for this problem, as you told me, i had change the data type of the variable to the CPictureBox, but it gave me so many errors, main of those is Storage value missing. what should i do?
You probably missed the step 4 I mentioned in the article. 4. Change the CStatic to CPictureBox. Don't forget to add the header files at the top. Adding the header files should shred off your errors.
hi there .. this tuto is intended for what version of vc++?? 6.0?? cus i don't have hte "ownerdrawn" option for the picture control..
and the include in picturebox.cpp #include "stdafx.h" #include "Wallpaper.h" #include "PictureBox.h" #include ".\picturebox.h" ----------------------------------- #include "Wallpaper.h" #include ".\picturebox.h" where are these 2 headers found?
The Wallpaper header files will be generated by the MS VC compiler. PictureBox.h is in the attachmet.
when u say "Add a picture Box to your application" is it the "picture" control?? the types available for are "frame","icon","bitmap","rectangle"Enhanced metafile"... still don't see "ownerdrawn"..... and where do i inlcude "picture.h" in my dialog class?
there's no "ownerdraw"... neither in styles nor extended styles too... thanks for quick responses btw
You dont need to convert the style to owner draw and it will work perfectly fine. I have edited the article for the errors. Thanks for pointing that out.
thanks very much!!! i have finally managed to use it!!! this is a great piece of code !!! it's the simplest method to load bitmap!!! thanks !!! i am glad i was helpful for your code correction one question is there a way to load jpeg??
You need GDI for that. I am planning to write one article on that but its lack of time at this moment.
how Display jpeg Picture in MFC dialog? hi Shabbir! In MFC application (Dialog based or Cform view), if i load bitmap image in the background, its taking more memory.. here is my coding.. Code: void CDlg_Splash::OnPaint() { CPaintDC dc(this); // device context for painting HBITMAP m_Bmap; CRect rect; HDC memdc; CString m_ifilename1; m_ifilename1 = "C:\\test.bmp"; GetClientRect(&rect); m_Bmap=(HBITMAP)::LoadImage(NULL,m_ifilename1,IMAGE_BITMAP,0,0,LR_LOADFROMFILE); memdc=::CreateCompatibleDC(dc.m_hDC); ::SelectObject(memdc,m_Bmap); BitBlt(dc.m_hDC,0,0,rect.right,rect.bottom,memdc,0,0,SRCCOPY); DeleteObject(m_Bmap); DeleteObject(memdc); } is it correct ? and also let me know is there any memory leakage? is it possible to load jpeg image in MFC dialog? (to avoid more memory usage) Thanks in Advance... Abdul Khathar A
You don't need to load the image in the Paint but can have the image loaded in the constructor and just display / Paint in the OnPaint