Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
public class PenStyleLinearGradientBrush
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
public class Form1
Inherits System.Windows.Forms.Form
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim g As Graphics = Me.CreateGraphics()
g.Clear(Me.BackColor)
Dim img = New Bitmap("yourfile.jpg")
Dim redBrush As New SolidBrush(Color.Red)
Dim txtrBrush As New TextureBrush(img)
Dim lgBrush As New LinearGradientBrush(New Rectangle(10, 10, 10, 10), Color.Red, Color.Black, 45.0F)
Dim pn1 As New Pen(redBrush, 4)
Dim pn2 As New Pen(txtrBrush, 20)
Dim pn3 As New Pen(lgBrush, 20)
g.DrawEllipse(pn1, 100, 100, 50, 50)
g.DrawRectangle(pn2, 80, 80, 100, 100)
g.DrawEllipse(pn3, 30, 30, 200, 200)
Console.WriteLine(pn1.PenType.ToString())
Console.WriteLine(pn2.PenType.ToString())
Console.WriteLine(pn3.PenType.ToString())
redBrush.Dispose()
txtrBrush.Dispose()
lgBrush.Dispose()
img.Dispose()
pn1.Dispose()
pn2.Dispose()
pn3.Dispose()
g.Dispose()
End Sub
Public Sub New()
MyBase.New()
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
End Sub
End Class