Is there a simple way to load an image file into the "picture" control when
running?
I think it's pretty simple. Just call LoadImage/LR_LOADFROMFILE to get the HANDLE (HBITMAP, HICON or
HCURSOR) for the file based image, and then SendMessage the "Picture" control an STM_SETIMAGE with
the appropriate IMAGE_BITMAP, IMAGE_ICON or IMAGE_CURSOR in the WPARAM and the HANDLE returned by
LoadImage in the LPARAM. If you use ClassWizard to map your "Picture" control to a CStatic member
variable, you could also take advantage of its specialized wrapper functions: SetBitmap, SetIcon or
SetCursor.
--
Jeff Partch [MVP]
---------
void CPictureDlg::OnShowPictureFromFile()
{
HANDLE image_handle;
image_handle = LoadImage(0,"picture.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
m_Picture.SendMessage(STM_SETIMAGE, IMAGE_BITMAP, (long) image_handle);
}
"Jeff Partch" <je...@mvps.org> wrote in message
news:#jC2#f9cCHA.2780@tkmsftngp08...
--
Ajay Kalra
ajay....@autodesk.com
"Rich" <rcomro...@earthlink.net> wrote in message
news:%6Jq9.34114$OB5.2...@newsread2.prod.itd.earthlink.net...
Well, XP adds the SS_REALSIZECONTROL style, but that's the only 'easy' way I see and I've never used
it so I can't recommend it because of that and the platform limitation it imposes. Otherwise, I
think you'd have to pass your HBITMAP through a routine that does a CreateCompatibleDC,
CreateCompatibleBitmap, SelectObject, StretchBlt, <Clean up> sort of thing, and pass the resultant
HBITMAP to STM_SETIMAGE or CStatic::SetBitmap.
--
Jeff Partch [MVP]