How to load BMP/PNG Images Using Picture control of MFC

Source: Internet
Author: User

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

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.