how to get a image in a .bmp file onto a Dialog in the program?
-
what I know is the path of the file. and I want to adjust the size of the image on the dialog, too. Thank you very much!!! ------------------- I am learning C++ and English
You can use a combination of
LoadImage
andStretchBlt
.
Nibu thomas Software Developer
-
what I know is the path of the file. and I want to adjust the size of the image on the dialog, too. Thank you very much!!! ------------------- I am learning C++ and English
And CBitmap and StretchDIBits
-
what I know is the path of the file. and I want to adjust the size of the image on the dialog, too. Thank you very much!!! ------------------- I am learning C++ and English
I think this way is good #include AtlImage.h CImage m_Image; m_Image.Load("c:\\picture.bmp"); //m_Image.BitBlt(GetDC()->m_hDC,CRect(0,0,800,600),CPoint(0,0)); m_Image.StretchBlt(GetDC()->m_hDC,CRect(0,0,200,200),CRect(0,0,800,600));
-
what I know is the path of the file. and I want to adjust the size of the image on the dialog, too. Thank you very much!!! ------------------- I am learning C++ and English
Hi ewighell, There are some steps of doing this: [1] Load the bmp in mem. Your can use CBitmap::Load to do this. the CBitmap class can give you a handle (HBITMAP) to this bitmap. [2] Create a dc by using CDC::CreateCompatibleDC; select the bmp handle into this dc (CDC::SelectObject). [3] Override the dialog's OnPaint function. use CDC::Bitblt or CDC::StretchBlt to render the bmp on to dialog surface. Regards, Chris