沉默的羔羊1024 2021-05-28 09:52 采纳率: 100%
浏览 48
已采纳

vc6.0用MFC运行程序出现错误提示

error C2039: 'SetDCPenColor' : is not a member of 'CPaintDC'

e:\vc6\vc6\vc620200511\vc6\vc98\include\afxwin.h(1012) : see declaration of 'CPaintDC'

这是错误提示的代码

dc.SetDCPenColor(0xF0F0F0);

afxwin.h中的代码是这样的

class CPaintDC : public CDC
{
    DECLARE_DYNAMIC(CPaintDC)

// Constructors
public:
    CPaintDC(CWnd* pWnd);   // BeginPaint

// Attributes
protected:
    HWND m_hWnd;
public:
    PAINTSTRUCT m_ps;       // actual paint struct!

// Implementation
public:
    virtual ~CPaintDC();
#ifdef _DEBUG
    virtual void AssertValid() const;
    virtual void Dump(CDumpContext& dc) const;
#endif
};

  • 写回答

2条回答 默认 最新

  • CSDN专家-link 2021-05-28 09:55
    关注

    速查:Windows NT:5.0及以上版本;Windows:不支持;Windows CE:不支持;头文件:wingdi.h;库文件:gdi32.lib。

    windows不支持这个函数,NT下才支持

    还是CPen pen(PS_SOLID,1,0xF0F0F0);

    dc.SelectObject(&pen);吧

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?