Here's how to use picture control to display a BMP image:
Looked up a bit setbitmap is defined like this:
/////////////////////////////////////////////////////////////////////////////////// //Ubmpresource: Image ID; uctrlresource:picture Control IDvoidSetBitmap (UINT ubmpresource, uint uctrlresource) {hbitmap hbitmap; CStatic*pstatic = (CStatic *) GetDlgItem (Uctrlresource); Hbitmap=(HBITMAP) LoadImage (AfxGetInstanceHandle (), Makeintresource (Ubmpresource), Image_bitmap,0, 0, lr_loadmap3dcolors); Pstatic->modifystyle (0xF, Ss_bitmap); Pstatic-SetBitmap (HBITMAP);} ///////////////////////////////////////////////////////////////////////////////////
By definition, write the following code at the beginning of the dialog box (the results are displayed successfully):
BOOL Clogindog::oninitdialog () {cdialog::oninitdialog ();//add a picture in the login windowhbitmap hbitmap;//Associate Picture IDHbitmap =(HBITMAP) LoadImage (AfxGetInstanceHandle (), Makeintresource (Idb_bitmap_login_pic), Image_bitmap,0,0, lr_loadmap3dcolors); //get a pointer to a static controlCStatic *pstatic= (CStatic *) GetDlgItem (idc_static_pic);//Control ID//sets the style of the static control so that it can use bitmaps, and the try-and-place label displays the centerPstatic->modifystyle (0xF, ss_bitmap|ss_centerimage); //To set the static control display bitmapPstatic->SetBitmap (HBITMAP);returnTRUE;}
Reprinted from: http://hi.baidu.com/urzalknsyzchrur/item/bb64252591cb2e132a0f1c5b
MFC displays images in the picture control (BMP