这个函数是什么意思?
IntersectRect(参数1,参数2)
CRect(参数1,参数2,参数3,参数4)
请问这个函数的各项参数分别对应距形的左上角?左下角?右上角?右下角?

解决方案 »

  1.   

    IntersectRect(参数1,参数2)
    //求两个RECT相交的部分(RECT)CRect rectOne(125,   0, 150, 200);
    CRect rectTwo(  0,  75, 350,  95);
    CRect rectInter;rectInter.IntersectRect(rectOne, rectTwo);// rectInter is now (125, 75, 150, 95)ASSERT(rectInter == CRect(125, 75, 150, 95));
    _______________________________________________
    CRect(参数1,参数2,参数3,参数4)
    请问这个函数的各项参数分别对应距形的左上角?左下角?右上角?右下角?
    //RIGHT
      

  2.   


    CRect(参数1,参数2,参数3,参数4)
    1:LEFT     
    2, TOP
    3  RIGHT
    4, BOTTOM
      

  3.   

    CRect( int l, int t, int r, int b );
    l:Left ; t:Top ; r: Right  b:Bottom
    这是MSDN上说的,其实前两个参数是矩形坐上角的坐标,后两个是右下角的坐标。BOOL IntersectRect( LPCRECT lpRect1, LPCRECT lpRect2 );
    如果lpRect1和lpRect2有相交部分,就返回真,反之亦然。
      

  4.   

    参考:CRect( );CRect( int l, int t, int r, int b );CRect( const RECT& srcRect );CRect( LPCRECT lpSrcRect );CRect( POINT point, SIZE size );CRect( POINT topLeft, POINT bottomRight );ParameterslSpecifies the left position of CRect.tSpecifies the top of CRect.rSpecifies the right position of CRect.bSpecifies the bottom of CRect.srcRectRefers to the RECT structure with the coordinates for CRect.lpSrcRectPoints to the RECT structure with the coordinates for CRect.pointSpecifies the origin point for the rectangle to be constructed. Corresponds to the top-left corner.sizeSpecifies the displacement from the top-left corner to the bottom-right corner of the rectangle to be constructed.topLeftSpecifies the top-left position of CRect.bottomRightSpecifies the bottom-right position of CRect.ResConstructs a CRect object. If no arguments are given, left, top, right, and bottom members are not initialized.The CRect( const RECT& ) and CRect( LPCRECT ) constructors perform a CopyRect. The other constructors initialize the member variables of the object directly.
    Example// default constructor doesn't initialize!
    CRect rectUnknown;// four-integers are left, top, right, and bottom
    CRect rect(0, 0, 100, 50);
    ASSERT(rect.Width() == 100);
    ASSERT(rect.Height() == 50);// Initialize from RECT stucture
    RECT sdkRect;
    sdkRect.left = 0;
    sdkRect.top = 0;
    sdkRect.right = 100;
    sdkRect.bottom = 50;CRect rect2(sdkRect);   // by reference
    CRect rect3(&sdkRect);  // by address
    ASSERT(rect2 == rect);
    ASSERT(rect3 == rect);// from a point and a size
    CPoint pt(0, 0);
    CSize sz(100, 50);
    CRect rect4(pt, sz);
    ASSERT(rect4 == rect2);// from two points
    CSize szTopLeft(0, 0);
    CRect rect5(szTopLeft, sz);
    ASSERT(rect5 == rect4);
      

  5.   

    CRect(参数1,参数2,参数3,参数4)
    1:LEFT     
    2, TOP
    3  RIGHT
    4, BOTTOM