Ok, straight ahead. I'm having two problems with PathGradientBrush now with this simple code:
Dim p As GraphicsPath Dim b As PathGradientBrush Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load p = New GraphicsPath p.AddEllipse(0, 0, 100, 100) b = New PathGradientBrush(p) b.CenterColor = Color.DodgerBlue b.SurroundColors(0) = Color.Transparent Me.Invalidate() End Sub Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint e.Graphics.SmoothingMode = SmoothingMode.AntiAlias e.Graphics.FillRectangle(b, 0, 0, 100, 100) End Sub
The problem is:
When this line runs: B.SurroundColors(0) = Color.Transparent, the property does not change (I added a breakpoint), even I tried using many colors, but the only result is the white surrounding color.
And in some examples, I found a method that helps changing the SourroundColor, SetSourroundColor on this msdn site, but I can't figure out, where is it? I'm using both .net 2.0 (on Visual Studio 2005, 2010) and .net 4.0 (on Visual Studio 2010) Object Browser but both failed to found out what SetSourroundColoris.
My target is only to draw a radial gradient circle.
Call me Zenocoding