我该如何在vb.net中绘制类似这样的圆形渐变?
![A Red Circular Gradient](https://istack.dev59.com/AAtV1.webp)
请查看这个优秀的页面。文章中的代码是用C#编写的。以下是你感兴趣的代码的VB.NET移植版本,并针对矩形填充进行了更新(基于文章中的三角形填充示例):
Dim pgb As New PathGradientBrush(New Point() { _
New Point(0, 0), _
New Point(0, Me.ClientRectangle.Height), _
New Point(Me.ClientRectangle.Width, Me.ClientRectangle.Height), _
New Point(Me.ClientRectangle.Width, 0)})
pgb.SurroundColors = New Color() {Color.Red}
pgb.CenterColor = Color.Gray
e.Graphics.FillRectangle(pgb, Me.ClientRectangle)
pgb.Dispose()
Dim pth As New GraphicsPath()
pth.AddEllipse(Me.ClientRectangle)
Dim pgb As New PathGradientBrush(pth)
pgb.SurroundColors = New Color() {Color.Red}
pgb.CenterColor = Color.Gray
e.Graphics.FillRectangle(pgb, Me.ClientRectangle)