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

求助:MFC一个例子中 变量出现个小问题

dujiang001 发布于 2012-07-21 23:14, 584 次点击
只有本站会员才能查看附件,请 登录
新人刚学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 编辑 ]
2 回复
#2
jiantiewen2012-07-21 23:37
不知道其它代码怎说?
#3
dujiang0012012-07-22 09:00
不知道论坛附件限制是多大 反正是把出错地方的文件都弄上来了
等高手指点一二 多谢
1