pDC->Chord(rectClient,
      CPoint(rectClient.CenterPoint().x, rectClient.right),
      CPoint(rectClient.right, rectClient.CenterPoint().y));

解决方案 »

  1.   

    pDC->Chord(rectClient, 
          CPoint(rectClient.CenterPoint().x, rectClient.right), 
          CPoint(rectClient.right, rectClient.CenterPoint().y)); 
    你这个好像不对吧,第二个参数怎么都是x,没有y?
    rectClient.right是不是rectClient.top?或者是rectClient.bottom?
    这个画弦的!在一个方框内,然后起点的与结束点与中心点相连的弦
      

  2.   

    void CDeviceContextView::OnDraw(CDC* pDC)
    {
          CDeviceContextDoc* pDoc = GetDocument();
          ASSERT_VALID(pDoc);
          CRect rectClient;
       GetClientRect(rectClient);   // Make a couple of pens and similar brushes.
       CPen penBlue, penRed;
       CBrush brushBlue, brushRed;
       CBrush* pOldBrush;
       CPen* pOldPen;   brushBlue.CreateSolidBrush(RGB(0, 0, 255));
       brushRed.CreateHatchBrush(HS_DIAGCROSS, RGB(255, 0, 0));
       penBlue.CreatePen(PS_SOLID | PS_COSMETIC, 1, RGB(0, 0, 255));
       penRed.CreatePen(PS_SOLID | PS_COSMETIC, 1, RGB(255, 0, 0));   // Draw from 3 o'clock to 6 o'clock, counterclockwise,
       // in a blue pen with a solid blue fill.
       pOldPen = pDC->SelectObject(&penBlue);
       pOldBrush = pDC->SelectObject(&brushBlue);   pDC->Chord(rectClient,
          CPoint(rectClient.right, rectClient.CenterPoint().y),
          CPoint(rectClient.CenterPoint().x, rectClient.right));   // Draw the remaining quarter chord from 6 o'clock
       // to 3 o'clock, counterclockwise, in a red pen
       // with the hatched brush.
       pDC->SelectObject(&penRed);
       pDC->SelectObject(&brushRed);   // Keep the same parameters, but reverse start and
       // end points.
       pDC->Chord(rectClient,
          CPoint(rectClient.CenterPoint().x, rectClient.right),
          CPoint(rectClient.right, rectClient.CenterPoint().y));   // Restore the previous pen.
       pDC->SelectObject(pOldPen);
    }内容即使这样的:要求也有 但是不懂chord参数是什么意思……麻烦给解释一下呗
      

  3.   


    BOOL Chord(
       LPCRECT lpRect,
       POINT ptStart,
       POINT ptEnd 
    );
    lpRect
    Specifies the bounding rectangle (in logical units). You can pass either a LPRECT or a CRect object for this parameter.ptStart
    Specifies the x- and y-coordinates of the point that defines the chord's starting point (in logical units). This point does not have to lie exactly on the chord. You can pass either a POINT structure or a CPoint object for this parameter.

    ptEnd
    Specifies the x- and y-coordinates of the point that defines the chord's ending point (in logical units). This point does not have to lie exactly on the chord. You can pass either a POINT structure or a CPoint object for this parameter
      

  4.   

    void CDeviceContextView::OnDraw(CDC* pDC) 

          CDeviceContextDoc* pDoc = GetDocument(); 
          ASSERT_VALID(pDoc); 
          CRect rectClient; 
      GetClientRect(rectClient);   // Make a couple of pens and similar brushes. 
      CPen penBlue, penRed; 
      CBrush brushBlue, brushRed; 
      CBrush* pOldBrush; 
      CPen* pOldPen;   brushBlue.CreateSolidBrush(RGB(0, 0, 255)); 
      brushRed.CreateHatchBrush(HS_DIAGCROSS, RGB(255, 0, 0)); 
      penBlue.CreatePen(PS_SOLID | PS_COSMETIC, 1, RGB(0, 0, 255)); 
      penRed.CreatePen(PS_SOLID | PS_COSMETIC, 1, RGB(255, 0, 0));   // Draw from 3 o'clock to 6 o'clock, counterclockwise, 
      // in a blue pen with a solid blue fill. 
      pOldPen = pDC->SelectObject(&penBlue); 
      pOldBrush = pDC->SelectObject(&brushBlue);   pDC->Chord(rectClient, 
          CPoint(rectClient.right, rectClient.CenterPoint().y), 
          CPoint(rectClient.CenterPoint().x, rectClient.right));   // Draw the remaining quarter chord from 6 o'clock 
      // to 3 o'clock, counterclockwise, in a red pen 
      // with the hatched brush. 
      pDC->SelectObject(&penRed); 
      pDC->SelectObject(&brushRed);   // Keep the same parameters, but reverse start and 
      // end points. 
      pDC->Chord(rectClient, 
          CPoint(rectClient.CenterPoint().x, rectClient.right), 
          CPoint(rectClient.right, rectClient.CenterPoint().y));   // Restore the previous pen. 
      pDC->SelectObject(pOldPen); 
    } 弦是怎么画出来的?chord中的参数不明白……
      

  5.   

    你这个是MSDN上面的吧
    第一个是rect,表示,这个弦是这个rect的内切圆或者的椭圆的一部分!其中,第二个参数为起始点,第三个参数是终点!
    从圆心到起始点、圆心到终点的两条连线与圆或者椭圆相交,得到的弦的起始与终点!
    然后画出来!