B
booboo_US
Guest
Hi:
I am using VB.NET 2019, and I am trying to draw an arc and a line. Please see the attached code. As you can see from the attached picture, the arc, and the arrowhead for the line are not very smooth. Is there a way to draw a smoother drawing. I appreciate a code. thank you.
Bob
Private Sub PictureBox4_Paint(sender As Object, e As PaintEventArgs) Handles PictureBox4.Paint
Dim pen As New Pen(Color.Red, 4)
Dim bigArrow = New AdjustableArrowCap(3, 3)
pen.StartCap = System.Drawing.Drawing2D.LineCap.NoAnchor
pen.CustomEndCap = bigArrow
' ---
'Draw line
Dim XStart As Integer = 20
Dim YStart As Integer = 175
Dim XEnd, YEnd As Integer
Dim penLength As Integer = 50
XEnd = XStart
YEnd = YStart - penLength
e.Graphics.DrawLine(pen, XStart, YStart, XEnd, YEnd)
' Draw arc to screen.
Dim rect As New Rectangle(30, 30, 50, 50)
Dim startAngle As Single = 45.0F
Dim sweepAngle As Single = 270.0F
e.Graphics.DrawArc(pen, rect, startAngle, sweepAngle)
End Sub
Continue reading...
I am using VB.NET 2019, and I am trying to draw an arc and a line. Please see the attached code. As you can see from the attached picture, the arc, and the arrowhead for the line are not very smooth. Is there a way to draw a smoother drawing. I appreciate a code. thank you.
Bob
Private Sub PictureBox4_Paint(sender As Object, e As PaintEventArgs) Handles PictureBox4.Paint
Dim pen As New Pen(Color.Red, 4)
Dim bigArrow = New AdjustableArrowCap(3, 3)
pen.StartCap = System.Drawing.Drawing2D.LineCap.NoAnchor
pen.CustomEndCap = bigArrow
' ---
'Draw line
Dim XStart As Integer = 20
Dim YStart As Integer = 175
Dim XEnd, YEnd As Integer
Dim penLength As Integer = 50
XEnd = XStart
YEnd = YStart - penLength
e.Graphics.DrawLine(pen, XStart, YStart, XEnd, YEnd)
' Draw arc to screen.
Dim rect As New Rectangle(30, 30, 50, 50)
Dim startAngle As Single = 45.0F
Dim sweepAngle As Single = 270.0F
e.Graphics.DrawArc(pen, rect, startAngle, sweepAngle)
End Sub
Continue reading...