1. Load BMP
Cstatic * pwnd = (cstatic *) getdlgitem (idc_pic); // obtain the picture control handle pwnd-> modifystyle (0, ss_bitmap ); // modify its properties to the bitmap pwnd-> setbitmap (hbitmap): LoadImage (null, _ T ("BMP .bmp"), image_bitmap, 100, 50, lr_createdibsection | lr_defaultsize | lr_loadfromfile ));
2. Load PNG
Cstatic * pwnd = (cstatic *) getdlgitem (idc_pic); // obtain the picture control handle cimage image; image. load (_ T ("png.png"); hbitmap hbmp = image. detach (); pwnd-> setbitmap (hbmp); pwnd-> setwindowpos (null, 0, 0,100, 50, swp_noactivate | swp_nomove | swp_nozorder );
3. select the image control in the resource editor-> Alt + enter to open the "Properties window" of the image control-> select the image type in "type"-> select an image in "image "resource ID.
Original article: http://hi.baidu.com/beachfish%CA%B7%D3%F1%CB%A7/blog/item/8addb204c5e93e9be850cd7b.html