erehw(疯狂CS)及各位高手进来看一下,有关位图做为背景的问题!!我快要疯了!!!!!!!!!
昨天,我问了一个有关位图做为背景的问题,要求在OnPaint()中实现的。
erehw(疯狂CS)回复如下:
void CAboutDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
CString strPath;
//GetModulePath(strPath);
//strPath += "\\LoginSpalsh.bmp";
strPath += "e:\\prj\\fpcontrol\\debug\\LoginSpalsh.bmp";
CDC tempDC;
CRect rect;
HBITMAP hBitmap=(HBITMAP)LoadImage(AfxGetApp()->m_hInstance,strPath,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
CBitmap m_BackBmp;
BITMAP bitmap;
m_BackBmp.Attach(hBitmap);
m_BackBmp.GetBitmap (&bitmap);
int nHeight=bitmap.bmHeight;
int nWidth =bitmap.bmWidth ;
GetClientRect(rect);
tempDC.CreateCompatibleDC(&dc);
tempDC.SelectObject(&m_BackBmp);
//dc.FillSolidRect(rect, RGB(212,208,202));
//pDC->FillSolidRect(rect, RGB(255,255,255));
dc.BitBlt(0,0, nWidth, nHeight, &tempDC, 0, 0, SRCCOPY );
tempDC.DeleteDC();
}
我在vc6中能够实现,但是,我的毕业设计要求在vc1.52,win16,windows3.2环境下.
我把代码照搬,编译时它不认得LoadImage,IMAGE_BITMAP,LR_LOADFROMFILE这几个东西.反正HBITMAP hBitmap=(HBITMAP)LoadImage(AfxGetApp()->m_hInstance,strPath,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
这句话它看不懂。
各为高手若有资料或别的方法请指点一下,最好有代码。我对vc不熟!!
有没有不用上面这句话的方法但要在OnPaint()中实现
谢谢!!
另能不能解释一下 HBITMAP hBitmap=(HBITMAP)LoadImage(AfxGetApp()->m_hInstance,strPath,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
我也看不懂
谢谢!