VS2010-MFC内显示图片

来源:互联网 发布:网络协议分析仪 编辑:程序博客网 时间:2024/04/28 05:26



void CmyImage006View::OnDraw(CDC *pDC){/*CmyImage006Doc* pDoc = GetDocument();ASSERT_VALID(pDoc);if (!pDoc)return;*/CBitmap bitmap;CDC cmc;bitmap.LoadBitmapW(IDB_BITMAP2);BITMAP bmp;bitmap.GetBitmap(&bmp);//bitmap.GetBitmap(&bmp);cmc.CreateCompatibleDC(pDC);cmc.SelectObject(&bitmap);//pDC->BitBlt(0,0,619,619,&cmc,0,0,SRCCOPY);//pDC->StretchBlt(0,0,619/2,619/2,&cmc,0,0,619,619,SRCCOPY);//pDC->BitBlt(0,0,800,800,&cmc,0,0,SRCCOPY);CRect cm;GetClientRect(&cm);//pDC->StretchBlt(0,0,cm.Width(),cm.Height(),&cmc,0,0,1024,1024,SRCCOPY);//pDC->BitBlt(0,0,cm.Width(),cm.Height(),&cmc,0,0,SRCCOPY);//pDC->StretchBlt(0,0,cm.Width(),cm.Height(),&cmc,0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY);pDC->StretchBlt(0,0,cm.Width(),cm.Height(),&cmc,0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY);// TODO: add draw code for native data here}


原创粉丝点击