0

Having a problem in drawing a 180degree arc (changing color after 90 Degrees) - The issue is the Arc's Horizontal and Vertical lines are not straight.

I know the start and Sweep angles are correct 180, 90 and 270, 90

Any help is aspirated.

enter image description here

my Code is....

 Private Sub drawArc(ByVal g As Graphics)
    Dim a = valueRange / 2
    drawArcSegment(g, minValue, a, optimumRangeColor)
    drawArcSegment(g, a, maxValue, actionRangeColor)End Sub

Sub drawArcSegment(ByVal g As Graphics, ByVal startValue As Double, ByVal EndValue As Double, ByVal segmentColor As Color)
    ' Set The Rectanglefor the Arc Segment
    Dim rect As New Rectangle(boarder + arcWidth2, arcCenter.Y - arcRadius, arcDiameter, arcDiameter)

    ' Set The Color of the Arc Segment
    Dim arcColor As New SolidBrush(segmentColor)
    Dim arcPen As New Pen(arcColor, arcWidth)

    ' Calulate the Start and Sweep Angle of the Arc Segment
    Dim startAngle As Single = (startValue * valueAngle) + 180
    Dim sweepAngle As Single = ((EndValue * valueAngle) + 180) - startAngle

    ' Draw Arc Segment
    g.DrawArc(arcPen, rect, startAngle, sweepAngle)
End Sub
  • You don't like the pen's start- and end-cap it uses. Often a problem with curves. No simple fix, consider using GraphicsPath instead. – Hans Passant Nov 19 '16 at 12:05
  • For example take a look at [How to draw a circular progressbar pie using GraphicsPath in WinForm?](https://stackoverflow.com/questions/36096759/how-to-draw-a-circular-progressbar-pie-using-graphicspath-in-winform) – Reza Aghaei Nov 19 '16 at 21:51
  • Perfect - have a nice clean arc's - Thanks – user2413698 Nov 26 '16 at 10:31

0 Answers0