void CMyProjetDlg::OnPaint()
{ CPaintDC dc(this);//用于绘制设备的上下文
CRect rect;
GetClientRect(&rect); //获取对话框长宽
CDC dcBmp; //定义并创建一个内存设备环境
dcBmp.CreateCompatibleDC(&dc); //创建兼容性DC
CBitmap bmpBackground;
bmpBackground.LoadBitmap(IDB_BITMAP1); //载入资源中图片
BITMAP m_bitmap;
bmpBackground.GetBitmap(&m_bitmap); //将图片载入位图中
CBitmap *pbmpOld=dcBmp.SelectObject(&bmpBackground); //将位图选入临时内存设备环境
dc.StretchBlt(,,rect.Width(),rect.Height(),&dcBmp,,,m_bitmap.bmWidth,m_bitmap.bmHeight,SRCCOPY);
//调用函数显示图片 }