CBitmap *pOldBmp;BITMAP bm;CDC mdc;m_Bmp->m_hObject = (HBITMAP)::LoadImage(AfxGetInstanceHandle(),path, //image路径IMAGE_BITMAP,0,0,LR_LOADFROMFILE | LR_CREATEDIBSECTION); mdc.CreateCompatibleDC(pDC);pOldBmp = mdc.SelectObject(m_Bmp);m_Bmp->GetBitmap(&bm);pDC->StretchBlt( point.x, point.y, imageWH.x, imageWH.y, &mdc, imagePoint.x, imagePoint.y, bm.bmWidth, bm.bmHeight, SRCCOPY);
2 回答
慕码人8056858
TA贡献1803条经验 获得超6个赞
扬帆大鱼
TA贡献1799条经验 获得超9个赞
CString path=L"c:\\1.bmp";
HBITMAP hbitmap=(HBITMAP)::LoadImage(AfxGetInstanceHandle(),path, IMAGE_BITMAP,0,0, LR_CREATEDIBSECTION|LR_LOADFROMFILE);
pictureControlID 为图像控件ID
CStatic *pStatic=(CStatic *)GetDlgItem(pictureControlID);
HBITMAP hbitmap=(HBITMAP)::LoadImage(AfxGetInstanceHandle(),path, IMAGE_BITMAP,0,0, LR_CREATEDIBSECTION|LR_LOADFROMFILE);
if(hbitmap!=NULL)
{
CBitmap m_bitmap;
m_bitmap.Attach(hbitmap);
pStatic->ModifyStyle(0xF,SS_BITMAP|SS_CENTERIMAGE);
pStatic->SetBitmap(hbitmap);
}
- 2 回答
- 0 关注
- 1547 浏览
添加回答
举报
0/150
提交
取消