注册 登录
编程论坛 VC++/MFC

位图在VIEW中的加载问题

guer168 发布于 2010-12-06 22:43, 1079 次点击
程序代码:
BOOL CMy11_30_1View::OnEraseBkgnd(CDC* pDC)
{
    // TODO: Add your message handler code here and/or call default
    CBitmap bitmap;
    bitmap.LoadBitmap(IDB_BITMAP1);
    CDC dcCompatible;
    dcCompatible.CreateCompatibleDC(pDC);
    dcCompatible.SelectObject(&bitmap)
    CRect rect;
    GetClientRect(&rect);
    pDC->BitBlt(0,0,rect.Width(),rect.Height(),&dcCompatible,0,0,SRCCOPY);
    return TRUE;
   
}
里为什么会出来现rect没有定义呢!?
e:\program files\vc98\mfc\include\afxwin.h(225) : see declaration of 'CRect'
G:\VC\11_30_1\11_30_1View.cpp(236) : error C2065: 'rect' : undeclared identifier
G:\VC\11_30_1\11_30_1View.cpp(238) : error C2228: left of '.Width' must have class/struct/union type
G:\VC\11_30_1\11_30_1View.cpp(238) : error C2228: left of '.Height' must have class/struct/union type
执行 cl.exe 时出错.

11_30_1.exe - 1 error(s), 0 warning(s)
1 回复
#2
guer1682010-12-06 23:13
呵呵我自已发现了问题了………………嘻嘻
dcCompatible.SelectObject(&bitmap)
原来是这里少了一个分号咧
1