1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Private ValueAngle As Single = 360
Private Sub Form1_Paint(sender As System.Object, e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim r As New Rectangle(250, 250, 250, 250)
Dim cp As New Point(CInt(r.Width / 2), CInt(r.Height / 2))
With e.Graphics
.SmoothingMode = SmoothingMode.AntiAlias
Using gp As New GraphicsPath
.TranslateTransform(cp.X, cp.Y)
.RotateTransform(ValueAngle)
.TranslateTransform(-cp.X, -cp.Y)
gp.StartFigure()
gp.AddPolygon(New Point() {New Point(cp.X, cp.Y - CInt(r.Height / 6)), New Point(cp.X + CInt(r.Height / 2), cp.Y), New Point(cp.X, cp.Y + CInt(r.Height / 6))})
.FillPath(New SolidBrush(Color.Gray), gp)
gp.Reset()
gp.AddEllipse(New Rectangle(CInt(r.Width / 3), CInt(r.Height / 3), CInt(r.Width / 3), CInt(r.Width / 3)))
.FillPath(New SolidBrush(Color.Gray), gp)
gp.CloseFigure()
End Using
End With
End Sub |
Partager