共用方式為


CPoint::CPoint

建構 CPoint 物件。

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

參數

  • initX
    指定 CPointx 成員的值。

  • initY
    指定 CPointy 成員的值。

  • initPt
    POINT 結構或 CPoint,它會指定用來初始化 CPoint 的值。

  • initSize
    SIZE 結構或 CSize,它會指定用來初始化 CPoint 的值。

  • dwPoint
    x 成員設定為 dwPoint 的低階層文字,並將 y 成員設定為 dwPoint 的高階層文字。

備註

如果未提供引數,xy 成員都會設定為 0。

範例

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);   

需求

標頭:atltypes.h

請參閱

參考

CPoint Class

階層架構圖表