|
GDI的就直接使用吧,, 不过现在还有更好的办法是 用GDI+ ,上网看相关资料
void ShowBmp(CString picname,CDC *pdc)
{
m_onpaint_name=picname;
HBITMAP hBitmap=(HBITMAP) ::LoadImage(NULL,picname,IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);
ASSERT(hBitmap);
HBITMAP OldBitmap;
CDC MemDC;
CRect rect;
MemDC.CreateCompatibleDC(pDc);
GetClientRect(rect);
OldBitmap=(HBITMAP)MemDC.SelectObject(hBitmap);
pDc->BitBlt(3,3,(rect.Width())-3,(rect.Height())-3,&MemDC,0,0,SRCCOPY);
MemDC.SelectObject(OldBitmap);
MemDC.DeleteDC();
DeleteObject((HGDIOBJ)hBitmap);
} |
|