rt

解决方案 »

  1.   

    如果你会画线宽为1的虚线
    // MFC中 CPen的构造函数
    CPen(
       int nPenStyle,
       int nWidth,
       COLORREF crColor 
    );
    CPen(
       int nPenStyle,
       int nWidth,
       const LOGBRUSH* pLogBrush,
       int nStyleCount = 0,
       const DWORD* lpStyle = NULL 
    );
    //nWidth 为线的宽度//CPen::CreatePen函数
    BOOL CreatePen(
       int nPenStyle,
       int nWidth,
       COLORREF crColor 
    );
    BOOL CreatePen(
       int nPenStyle,
       int nWidth,
       const LOGBRUSH* pLogBrush,
       int nStyleCount = 0,
       const DWORD* lpStyle = NULL 
    );//nWidth为线宽//Win32 API 下HPEN CreatePen(
      int fnPenStyle,    // pen style
      int nWidth,        // pen width
      COLORREF crColor   // pen color
    );
    //nWidth 为线宽
    //API CreatePenIndirect
    HPEN CreatePenIndirect(
      CONST LOGPEN *lplgpn   // style, width, and color
    );//LOGPEN定义为
    typedef struct tagLOGPEN { 
      UINT     lopnStyle; 
      POINT    lopnWidth; 
      COLORREF lopnColor; 
    } LOGPEN, *PLOGPEN; //POINT定义为
    typedef struct tagPOINT { 
      LONG x; 
      LONG y; 
    } POINT, *PPOINT; //其中x为线宽, y无用.
    //API ExtCreatePen
    HPEN ExtCreatePen(
      DWORD dwPenStyle,      // pen style
      DWORD dwWidth,         // pen width
      CONST LOGBRUSH *lplb,  // brush attributes
      DWORD dwStyleCount,    // length of custom style array
      CONST DWORD *lpStyle   // custom style array
    );//dwWidth为线宽
    如果你不会画宽度为1的虚线, 代码就太多了, 我就不帖了..
      

  2.   

    http://blog.csdn.net/happyparrot/article/details/4406357