zoukankan      html  css  js  c++  java
  • MFC 的 Picture Control 加载 BMP/PNG 图片的方法

    1. 加载 BMP

    1. CStatic* pWnd = (CStatic*)GetDlgItem(IDC_PIC); // 得到 Picture Control 句柄  
    2. pWnd->ModifyStyle(0, SS_BITMAP); // 修改它的属性为位图  
    3. pWnd->SetBitmap((HBITMAP)::LoadImage(NULL, _T("bmp.bmp"),   
    4.                 IMAGE_BITMAP,   
    5.                 100,   
    6.                 50,   
    7.                 LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE));  
    2. 加载 PNG

    1. CStatic* pWnd = (CStatic*)GetDlgItem(IDC_PIC); // 得到 Picture Control 句柄  
    2. CImage image;  
    3. image.Load(_T("png.png");  
    4. HBITMAP hBmp = image.Detach();  
    5. pWnd->SetBitmap(hBmp);  
    6. pWnd->SetWindowPos(NULL,   
    7.                    0,   
    8.                    0,   
    9.                    100,   
    10.                    50,   
    11.                    SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);  
    3. 在资源编辑器中选定图片控件 -> Alt+Enter 打开该图片控件的“属性窗口” -> 在 "Type" 中选定图片类型 -> 在"Image"中选定图片对应的资源 ID.

     

         
    原文: http://hi.baidu.com/beachfish%CA%B7%D3%F1%CB%A7/blog/item/8addb204c5e93e9be850cd7b.html

  • 相关阅读:
    第09组 Beta冲刺(2/5)
    第09组 Beta冲刺(3/5)
    第09组 Beta冲刺(4/5)
    第09组 Beta冲刺(5/5)
    第09组 Beta冲刺(1/5)
    SDN课程阅读作业(2)
    C语言I作业07
    C语言I博客作业05
    C语言I博客作业04
    C语言I博客作业03
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13318736.html
Copyright © 2011-2022 走看看