bmp图片在对话框的全屏显示

void quxian::OnPaint()

 {

CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here CRect rcclient; GetClientRect(&rcclient);

int nBmpX; int nBmpY;

HDC hDC; HBITMAP hBitmap=(HBITMAP)::LoadImage(NULL,"d://Temp.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);

BITMAP bmp;

GetObject(hBitmap,sizeof(bmp),&bmp); nBmpX=bmp.bmWidth; nBmpY=bmp.bmHeight;

hDC=CreateCompatibleDC(NULL);

SelectObject(hDC,hBitmap); // CClientDC dc(this);

StretchBlt(dc,0,0,rcclient.Width(), rcclient.Height(),hDC,0,0,nBmpX,nBmpY,SRCCOPY); // Do not call CDialog::OnPaint() for painting messages }

/////////////////////////////////

LoadImage(NULL,"d://Temp.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);

绝对路径

LoadImage(NULL,"Temp.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);

如果图片在当前目录

阅读更多
文章标签: image null
个人分类: mfc
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭