试图让那个中心区域充满,不知道我做错了什么。
Imports System.Drawing.Drawing2D
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub Form1_Paint(sender As System.Object, e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim gp As GraphicsPath = CreatePath(New Rectangle(New Point(200, 200), New Size(250, 100)))
e.Graphics.FillPath(New SolidBrush(Color.LightBlue), gp)
e.Graphics.DrawPath(New Pen(Color.Black), gp)
End Sub
Private Function CreatePath(ByVal area As Rectangle) As GraphicsPath
Dim gp As New GraphicsPath()
Dim rect As Rectangle = New Rectangle(area.Location, New Size(area.Width, area.Height \ 3))
gp.AddEllipse(rect)
Dim hadj As Integer = area.Height \ 4
gp.AddLine(New Point(area.X, area.Y + area.Height - hadj), New Point(area.X, area.Y + (rect.Height \ 3) + 8))
Dim gh As Integer = area.Width \ 4
Dim pts(4) As PointF
pts(0) = New PointF(area.X, area.Y + area.Height - hadj)
pts(1) = New Point(area.X + gh, area.Y + area.Height - (hadj \ 2))
pts(2) = New Point(area.X + gh * 2, area.Y + area.Height - (hadj \ 3))
pts(3) = New Point(area.X + gh * 3, area.Y + area.Height - (hadj \ 2))
pts(4) = New Point(area.X + area.Width, area.Y + area.Height - hadj)
gp.AddCurve(pts)
gp.AddLine(New PointF(area.X + area.Width, area.Y + (rect.Height \ 3) + 9), New PointF(area.X + area.Width, area.Y + area.Height - hadj))
Return gp
End Function
End Class