简单小问题,请您帮忙,函数Arc()说明

jzww2003 2005-05-20 11:42:50
BOOL Arc(
HDC hdc, // handle to device context
int nLeftRect, // x-coord of bounding rectangle's upper-left corner
int nTopRect, // y-coord of bounding rectangle's upper-left corner
int nRightRect, // x-coord of bounding rectangle's lower-right corner
int nBottomRect, // y-coord of bounding rectangle's lower-right corner
int nXStartArc, // first radial ending point
int nYStartArc, // first radial ending point
int nXEndArc, // second radial ending point
int nYEndArc // second radial ending point
);

这是msdn给Arc的说明
谁能把参数给我说明一下
最好举例一下
画弧,这么多参数,看是能看懂,就是用的时候没有完全明白

请给个例子说明
...全文
114 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
greenteanet 2005-05-20
  • 打赏
  • 举报
回复
CDC::Arc
Draws an elliptical arc.

BOOL Arc(
int x1,
int y1,
int x2,
int y2,
int x3,
int y3,
int x4,
int y4
);
BOOL Arc(
LPCRECT lpRect,
POINT ptStart,
POINT ptEnd
);
Parameters
x1
Specifies the x-coordinate of the upper-left corner of the bounding rectangle (in logical units).
y1
Specifies the y-coordinate of the upper-left corner of the bounding rectangle (in logical units).
x2
Specifies the x-coordinate of the lower-right corner of the bounding rectangle (in logical units).
y2
Specifies the y-coordinate of the lower-right corner of the bounding rectangle (in logical units).
x3
Specifies the x-coordinate of the point that defines the arc's starting point (in logical units). This point does not have to lie exactly on the arc.
y3
Specifies the y-coordinate of the point that defines the arc's starting point (in logical units). This point does not have to lie exactly on the arc.
x4
Specifies the x-coordinate of the point that defines the arc's endpoint (in logical units). This point does not have to lie exactly on the arc.
y4
Specifies the y-coordinate of the point that defines the arc's endpoint (in logical units). This point does not have to lie exactly on the arc.
lpRect
Specifies the bounding rectangle (in logical units). You can pass either an LPRECT or a 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.
Return Value
Nonzero if the function is successful; otherwise 0.

Remarks
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);
}
jzww2003 2005-05-20
  • 打赏
  • 举报
回复
Thank you

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧