CDC *m_pDC;
COLORREF ColorValue=RGB(255,255,255);
CRect rect=CRect(50,50,200,200);
CBrush newBrush;
CBrush *oldBrush;
newBrush.CreateSolidBrush(ColorValue);
oldBrush=m_pDC->SelectObject(&newBrush);
m_pDC->Rectangle(rect);
m_pDC->DrawEdge(rect,EDGE_SUNKEN,BF_RECT);
m_pDC->SelectObject(oldBrush);
調試結果: oldBrush=m_pDC->SelectObject(&newBrush);總是出錯 句柄為NULL
CDC *m_pDC;,這個m_pDC只指向哪個DC的?你這麼寫是是聲明一個CDC的對象而已,實例化呢?