Picture Control 加载路径图片

    //CBitmap bitmap;
    //HBITMAP hBmp;
    //bitmap.LoadBitmap(strImgPath);
    //hBmp = (HBITMAP)bitmap.GetSafeHandle();
    //m_btn_pic_.SetBitmap(hBmp); 

    CString strImgPath = _T("D:\\Code - temp - UI\\{F4A6D522-EC03-45CA-9DA2-8B098F820FE3}.jpg");
    CImage image;
    image.Load(strImgPath);
    CRect rtPic;
    GetDlgItem(IDC_STATIC_CASE_PIC)->GetClientRect(rtPic);
    CDC *pDc = GetDlgItem(IDC_STATIC_CASE_PIC)->GetDC();
    pDc->SetStretchBltMode(STRETCH_HALFTONE);
    //int ModeOld = SetStretchBltMode(pDc->m_hDC, STRETCH_HALFTONE);
    image.Draw(pDc->m_hDC, rtPic);
    //SetStretchBltMode(pDc->m_hDC, ModeOld);
    ReleaseDC(pDc);
    image.Destroy();

 

你可能感兴趣的:(Picture Control 加载路径图片)