Imports System.Drawing.Drawing2D
Public Class Form1


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim g As Graphics = Me.CreateGraphics()     '生成图形对象 
        Dim Mypen As New Pen(Color.Green, 5)        '生成画笔 
        Dim MyBrush As New LinearGradientBrush(New Point(0, 20), _
                 New Point(20, 0), Color.Yellow, Color.Blue) '生成渐变画刷 
        g.FillRectangle(MyBrush, 0, 0, 200, 100)  '填充矩形 
    End Sub

End Class
