我需要绘制一个圆圈,在这个圆圈中我必须放置一个角落接触圆线的正方形。
之后,剩下的四个部分必须用不同的颜色着色。
方形的颜色并不重要。
答案 0 :(得分:2)
尝试这样的事情:
Public Class Form1
Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
Dim radius As Integer = 100
Dim center As New Point(125, 125)
Dim Y As Integer = radius * Math.Sin(45 * Math.PI / 180)
Dim X As Integer = radius * Math.Cos(45 * Math.PI / 180)
Dim centerRC As New Rectangle(center.X - X, center.Y - Y, X * 2, Y * 2)
Dim ellipseRC As New Rectangle(center.X - radius, center.Y - radius, radius * 2, radius * 2)
e.Graphics.ExcludeClip(centerRC)
e.Graphics.FillPie(Brushes.Red, ellipseRC, 225, 90)
e.Graphics.FillPie(Brushes.Green, ellipseRC, -45, 90)
e.Graphics.FillPie(Brushes.Blue, ellipseRC, 45, 90)
e.Graphics.FillPie(Brushes.White, ellipseRC, 135, 90)
End Sub
End Class
结果: