共用方式為


CPoint::CPoint

Constructs a CPoint object.

CPoint( ) throw( ); 
CPoint(
   int initX,
   int initY 
) throw( );
CPoint(
   POINT initPt 
) throw( );
CPoint(
   SIZE initSize 
) throw( );
CPoint(
   LPARAM dwPoint 
) throw( );

Parameters

  • initX
    Specifies the value of the x member of CPoint.

  • initY
    Specifies the value of the y member of CPoint.

  • initPt
    POINT structure or CPoint that specifies the values used to initialize CPoint.

  • initSize
    SIZE structure or CSize that specifies the values used to initialize CPoint.

  • dwPoint
    Sets the x member to the low-order word of dwPoint and the y member to the high-order word of dwPoint.

Remarks

If no arguments are given, x and y members are not initialized.

Example

CPoint   ptUndefined;
CPoint   ptTopLeft(0,0);

// works from a POINT, too

POINT   ptHere;
ptHere.x = 35;
ptHere.y = 95;

CPoint   ptMFCHere(ptHere);

// works from A SIZE

SIZE   sHowBig;
sHowBig.cx = 300;
sHowBig.cy = 10;

CPoint ptMFCBig(sHowBig);

// or from a DWORD

DWORD   dwSize;
dwSize = MAKELONG(35, 95);

CPoint ptFromDouble(dwSize);
ASSERT(ptFromDouble == ptMFCHere);   

Requirements

Header: atltypes.h

See Also

Reference

CPoint Class

Hierarchy Chart

Other Resources

CPoint Members