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
};

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

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

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

dc.SelectObject(&pen);吧

您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~

如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632