ar<<(DWORD)XXX;//XXX是COLORREF型的变量

解决方案 »

  1.   

    COLORREF
    The COLORREF value is used to specify an RGB color. typedef DWORD COLORREF;
    typedef DWORD *LPCOLORREF;
    Res
    When specifying an explicit RGB color, the COLORREF value has the following hexadecimal form: 0x00bbggrr 
    The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; and the third byte contains a value for blue. The high-order byte must be zero. The maximum value for a single byte is 0xFF. To create a COLORREF color value, use the RGB macro. To extract the individual values for the red, green, and blue components of a color value, use the GetRValue, GetGValue, and GetBValue macros, respectively. 
      

  2.   

    void CStroke::Serialize( CArchive& ar )
    { if( ar.IsStoring( ) )
    {
    ar << m_rectBounding;
    ar << (WORD)m_nPenWidth;
    ar<<(DWORD)m_clrPenColor;
    m_pointArray.Serialize( ar );
    }
    else
    {
    ar >> m_rectBounding;
    WORD w;
             DWORD w2;
    ar >> w;
    m_nPenWidth = w;
    ar>>w2;
    m_clrPenColor=w2;
    m_pointArray.Serialize( ar );
    }
    }
    有错误么?
      

  3.   

    我觉得你的代码没什么问题,要不试试下面的代码如何?
    void CStroke::Serialize( CArchive& ar )
    {
    m_pointArray.Serialize( ar );if( ar.IsStoring( ) )
    {
    ar << m_rectBounding;
    ar << (WORD)m_nPenWidth;
    ar<<(DWORD)m_clrPenColor;
    }
    else
    {
    ar >> m_rectBounding;
    ar >> (WORD)m_nPenWidth;
    ar >>(DWORD)m_clrPenColor;}
    }