求助:MFC一个例子中 变量出现个小问题
ske.zip
(5.06 KB)
新人刚学C++ 调了一个MFC的例子 但是就是有一个变量怎么也调不通 希望高人指点一下 void CRectangle::Draw(CDC* pDC)
{
// Create a pen for this object and
// initialize it to the object color and line width of 1 pixel
CPen aPen;
if(!aPen.CreatePen(PS_SOLID, m_Pen, m_Color))
{
// Pen creation failed
AfxMessageBox(_T("Pen creation failed drawing a rectangle"), MB_OK);
AfxAbort();
}
// Select the pen
CPen* pOldPen = pDC->SelectObject(&aPen);
// Select the brush
CBrush* pOldBrush = (CBrush*)pDC->SelectStockObject(NULL_BRUSH);
// Now draw the rectangle
pDC->Rectangle(m_EnclosingRect);
pDC->SelectObject(pOldBrush); // Restore the old brush
pDC->SelectObject(pOldPen); // Restore the old pen
}
error C2039: 'pDC' : is not a member of 'CDC'
error C2039: 'pDC' : is not a member of 'CDC'
error C2232: '->CDC::SelectObject' : left operand has '' type, use '.'
这个我就很不懂了
附上我的代码 请高手指点一下
多谢!
[ 本帖最后由 dujiang001 于 2012-7-22 08:59 编辑 ]