CDC::Arc


CRect object for this parameter.

ptStart

Specifies the x- and y-coordinates of the point that defines the arc’s starting point (in logical units). This point does not have to lie exactly on the arc. 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 arc’s ending point (in logical units). This point does not have to lie exactly on the arc. You can pass either a POINT structure or a CPoint object for this parameter.

Remarks

Draws an elliptical arc. The arc drawn by using the function is a segment of the ellipse defined by the specified bounding rectangle.

The actual starting point of the arc is the point at which a ray drawn from the center of the bounding rectangle through the specified starting point intersects the ellipse. The actual ending point of the arc is the point at which a ray drawn from the center of the bounding rectangle through the specified ending point intersects the ellipse. The arc is drawn in a counterclockwise direction. Since an arc is not a closed figure, it is not filled. Both the width and height of the rectangle must be greater than 2 units and less than 32,767 units.

Example

void CCurvesView::OnDraw(CDC* pDC)
{
    // Fill the client area with a thin circle. The circle's
    // interior is not filled. The circle's perimeter is
    // blue from 6 o'clock to 3 o'clock and red from 3
    // o'clock to 6 o'clock.
    // Get the client area.

CRect rectClient;

GetClientRect(rectClient);
    // Make a couple of pens.

CPen penBlue;

CPen penRed;

CPen* pOldPen;

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. pOldPen = pDC->SelectObject(&penBlue);

pDC->Arc(rectClient,

CPoint(rectClient.right, rectClient.CenterPoint().y),

CPoint(rectClient.CenterPoint().x, rectClient.right));


    // Draw from 6 o'clock to 3 o'clock, counterclockwise,
    // in a red pen. pDC->SelectObject(&penRed);
    // Keep the same parameters, but reverse start
    // and end points.

pDC->Arc(rectClient, CPoint(rectClient.CenterPoint().x, rectClient.right), CPoint(rectClient.right, rectClient.CenterPoint().y));
// Restore the previous pen.

pDC->SelectObject(pOldPen);
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值