求教 显示图片
我要显示一个图片,但是不能显示.代码如下
CPaintDC dc(this); // device context for painting
RECT rect;
CDC*md=new CDC; //建立一暂存DC md
CBitmap*bitmap=new CBitmap;//建立位图对象
GetClientRect(&rect);//取得操作窗口大小
md->CreateCompatibleDC(&dc);//将md转换成与dc兼容的dc
bitmap->m_hObject=(HBITMAP)::LoadImage(NULL,"幽潭.bmp",IMAGE_BITMAP,rect.right,rect.bottom,LR_LOADFROMFILE);
md->SelectObject(bitmap);//加载位图
dc.BitBlt(0,0,rect.right,rect.bottom,md,0,0,SRCCOPY);
delete md;//释放资源
delete bitmap;//释放资源