Imports System.Drawing.Drawing2D
Public Class Form1

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Form1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Click
        ColorDialog1.ShowDialog()            '显示“颜色”对话框
        Me.BackColor = ColorDialog1.Color    '设置窗体的背景颜色为选定的颜色

    End Sub

    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As PaintEventArgs) Handles MyBase.Paint
        Dim gobj As Graphics = Me.CreateGraphics()
        Dim sf1 As New StringFormat()
        Dim sf2 As New StringFormat()
        Dim f As New Font("隶书", 20, FontStyle.Bold)
        Dim bobj1 As New HatchBrush(HatchStyle.Vertical, Color.Blue, Color.Green)
        Dim bobj2 As New SolidBrush(Color.Red)
        sf1.Alignment = StringAlignment.Far        '右对齐文本
        sf2.FormatFlags = StringFormatFlags.DirectionVertical  '垂直绘制文本
        gobj.DrawString("VB.NET程序设计", f, bobj1, 220, 15, sf1)
        gobj.DrawString("大家好", f, bobj2, 100, 50, sf2)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim clr1 As Color = Color.FromArgb(122, 25, 255)
        Dim clr2 As Color = Color.FromKnownColor(KnownColor.LightPink)     'KnownColor为枚举类型
        Dim clr3 As Color = Color.FromName("SlateBlue")
        Button1.ForeColor = Color.FromArgb(255, 0, 0)                '红色
        Button1.BackColor = Color.FromKnownColor(KnownColor.Blue)    '蓝色
    End Sub

End Class
