MFC displays images in the picture control (BMP

Source: Internet
Author: User
Tags bmp image

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.