有谁知道CPoint类的代码?

解决方案 »

  1.   

    申明
    class CPoint : public tagPOINT
    {
    public:
    // Constructors // create an uninitialized point
    CPoint();
    // create from two integers
    CPoint(int initX, int initY);
    // create from another point
    CPoint(POINT initPt);
    // create from a size
    CPoint(SIZE initSize);
    // create from a dword: x = LOWORD(dw) y = HIWORD(dw)
    CPoint(DWORD dwPoint);// Operations// translate the point
    void Offset(int xOffset, int yOffset);
    void Offset(POINT point);
    void Offset(SIZE size); BOOL operator==(POINT point) const;
    BOOL operator!=(POINT point) const;
    void operator+=(SIZE size);
    void operator-=(SIZE size);
    void operator+=(POINT point);
    void operator-=(POINT point);// Operators returning CPoint values
    CPoint operator+(SIZE size) const;
    CPoint operator-(SIZE size) const;
    CPoint operator-() const;
    CPoint operator+(POINT point) const;// Operators returning CSize values
    CSize operator-(POINT point) const;// Operators returning CRect values
    CRect operator+(const RECT* lpRect) const;
    CRect operator-(const RECT* lpRect) const;
    };
      

  2.   

    源代码在include目录的afxwin1.h不是src目录// CPoint
    _AFXWIN_INLINE CPoint::CPoint()
    { /* random filled */ }
    _AFXWIN_INLINE CPoint::CPoint(int initX, int initY)
    { x = initX; y = initY; }
    #if !defined(_AFX_CORE_IMPL) || !defined(_AFXDLL) || defined(_DEBUG)
    _AFXWIN_INLINE CPoint::CPoint(POINT initPt)
    { *(POINT*)this = initPt; }
    #endif
    _AFXWIN_INLINE CPoint::CPoint(SIZE initSize)
    { *(SIZE*)this = initSize; }
    _AFXWIN_INLINE CPoint::CPoint(DWORD dwPoint)
    {
    x = (short)LOWORD(dwPoint);
    y = (short)HIWORD(dwPoint);
    }
    _AFXWIN_INLINE void CPoint::Offset(int xOffset, int yOffset)
    { x += xOffset; y += yOffset; }
    _AFXWIN_INLINE void CPoint::Offset(POINT point)
    { x += point.x; y += point.y; }
    _AFXWIN_INLINE void CPoint::Offset(SIZE size)
    { x += size.cx; y += size.cy; }
    _AFXWIN_INLINE BOOL CPoint::operator==(POINT point) const
    { return (x == point.x && y == point.y); }
    _AFXWIN_INLINE BOOL CPoint::operator!=(POINT point) const
    { return (x != point.x || y != point.y); }
    _AFXWIN_INLINE void CPoint::operator+=(SIZE size)
    { x += size.cx; y += size.cy; }
    _AFXWIN_INLINE void CPoint::operator-=(SIZE size)
    { x -= size.cx; y -= size.cy; }
    _AFXWIN_INLINE void CPoint::operator+=(POINT point)
    { x += point.x; y += point.y; }
    _AFXWIN_INLINE void CPoint::operator-=(POINT point)
    { x -= point.x; y -= point.y; }
    _AFXWIN_INLINE CPoint CPoint::operator+(SIZE size) const
    { return CPoint(x + size.cx, y + size.cy); }
    _AFXWIN_INLINE CPoint CPoint::operator-(SIZE size) const
    { return CPoint(x - size.cx, y - size.cy); }
    _AFXWIN_INLINE CPoint CPoint::operator-() const
    { return CPoint(-x, -y); }
    _AFXWIN_INLINE CPoint CPoint::operator+(POINT point) const
    { return CPoint(x + point.x, y + point.y); }
    _AFXWIN_INLINE CSize CPoint::operator-(POINT point) const
    { return CSize(x - point.x, y - point.y); }
    _AFXWIN_INLINE CRect CPoint::operator+(const RECT* lpRect) const
    { return CRect(lpRect) + *this; }
    _AFXWIN_INLINE CRect CPoint::operator-(const RECT* lpRect) const
    { return CRect(lpRect) - *this; }
      

  3.   

    在vc里面,调用cpoint类的成员函数然后调试的时候跟进去调试,就可以看到成员函数的内容或者在VC7里面,从cpoint类里面派生一个类cmy然后可以看到你这个cmy类的基类的所有成员函数
      

  4.   

    handsomerun(毛毛)的好方法。
    想要看MFC什么代码,我们可以定义该对象,然后调试时F11进去。
    当然,前提是你安装时VC时,要把MFC源代码也安装上去才行。