使用角度arc()划分圆在mfc中无法正常工作。 [英] Dividing a circle using angle arc() is not working properly in mfc.
问题描述
当起始角度为0并且扫过任何其他角度时,没有问题,但是当起始角度不是0时,该段将不正确。
我尝试了什么:
要将圆圈从0划分为360,我使用了BeginPath(hMemDC);
MoveToEx(hMemDC, 50 , 50 ,(LPPOINT)NULL);
AngleArc(hMemDC, 50 , 50 , 47 , 0 , 45 );
SetArcDirection(m_hMemDC,AD_CLOCKWISE);
LineTo(hMemDC, 50 , 50 );
EndPath(hMemDC);
StrokeAndFillPath(hMemDC);
然后
BeginPath(hMemDC);
MoveToEx(hMemDC, 50 , 50 ,(LPPOINT)NULL);
AngleArc(hMemDC, 50 , 50 , 47 , 45 , 90 );
SetArcDirection(m_hMemDC,AD_CLOCKWISE);
LineTo(hMemDC, 50 , 50 );
EndPath(hMemDC);
StrokeAndFillPath(hMemDC);
等等(90到135,135到180 .....)
但不能正常工作。请帮帮我
AngleArch
的最后一个参数(扫掠角度)是相对于起始角度的。因此,如果要绘制45到90度的圆弧,则必须为此参数传递45。
请参阅 CDC :: AngleArc [ ^ ]:引用:fSweepAngle
指定相对于起始角度的扫描角度。
调用SetArcDirection
是没用的。它不会影响AngleArc
,但必须在此之前调用Arc
函数。
圆弧绘图的例子可以在 CDC,Arc,ArcTo,Pie,Chord,AngleArc, Visual C ++源代码 [ ^ ]。
when start angle is 0 and sweep any other angle then there will be no problem but when start angle is other than 0 then the segment will not be proper.
What I have tried:
To divide circle from 0 to 360, i used BeginPath(hMemDC);
MoveToEx(hMemDC,50,50 , (LPPOINT) NULL);
AngleArc(hMemDC, 50 , 50 , 47, 0, 45);
SetArcDirection(m_hMemDC, AD_CLOCKWISE);
LineTo(hMemDC,50,50);
EndPath(hMemDC);
StrokeAndFillPath(hMemDC);
then
BeginPath(hMemDC);
MoveToEx(hMemDC,50,50 , (LPPOINT) NULL);
AngleArc(hMemDC, 50 , 50 , 47, 45, 90);
SetArcDirection(m_hMemDC, AD_CLOCKWISE);
LineTo(hMemDC,50,50);
EndPath(hMemDC);
StrokeAndFillPath(hMemDC);
and so on (90 to 135 , 135 to 180 ..... )
but not working properly. Please help me
The last argument toAngleArch
(the sweep angle) is relative to the start angle. So if you want to draw an arc from 45 to 90 degrees, you have to pass 45 for this argument.
See CDC::AngleArc[^]:Quote:fSweepAngle
Specifies the sweep angle in degrees relative to the starting angle.
CallingSetArcDirection
is useless. It does not effectAngleArc
but theArc
function and must be called before that.
Examples on arc drawing can be found at CDC, Arc, ArcTo, Pie, Chord, AngleArc, Visual C++ Source Code[^].
这篇关于使用角度arc()划分圆在mfc中无法正常工作。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!