我想在一个简单C++类中声明一个pen 类可是不行class CDrawFontInfo
{
pen m_pen;//在这里声明
public:
CString GetFont();
void SetFont();
CDrawFontInfo(void);
~CDrawFontInfo(void);
};
我加了头文件#include"Gdipluspen.h" #include "Gdiplus.h"可是好像还是不行会报奇怪的错误看看怎么办

解决方案 »

  1.   

    是Pen,你不需要包含"Gdipluspen.h",你只需要#include <gdiplus.h>
      

  2.   

    d:\VC\nc\goodDoc\DrawPen.h(13): error C2146: 语法错误 : 缺少“;”(在标识符“m_pen”的前面)
    头文件声明如下
    #pragma once
    #include"DrawColor.h"
    #include <gdiplus.h>
    class CDrawPenInfo
    {
    public:
    CDrawPenInfo(void);
    ~CDrawPenInfo(void);
    public:
    int mi_Width;//线的宽度
    int mi_type;//画线的形式1表示用位图画,2表示用画刷,3表默认
    CDrawColorInfo m_PenColor;
    Pen m_pen;//************************这里出错了

    public:
    void SetPenWidth(int li_width);};
    执行文件如下
    #include "StdAfx.h"
    #include "drawpen.h"CDrawPenInfo::CDrawPenInfo(void)
    {
    }CDrawPenInfo::~CDrawPenInfo(void)
    {
    }
    void CDrawPenInfo::SetPenWidth(int li_width)
    {
    mi_Width=li_width;
    }
      

  3.   

    只用#include    <gdiplus.h  > 
    试过了还是不行
      

  4.   

    #include <afxwin.h>……CPen m_pen;
      

  5.   

    只需要#include <gdiplus.h>,导入GdiPlus.lib,你应该有GDI+ 的SDK!!
      

  6.   

    Pen m_pen;//************************这里出错了
    你是打掉了个C还是程序里面也写错了啊  应该是CPen啊