Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents white As System.Windows.Forms.Button
Friend WithEvents black As System.Windows.Forms.Button
Friend WithEvents yellow As System.Windows.Forms.Button
Friend WithEvents Green As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.white = New System.Windows.Forms.Button
Me.black = New System.Windows.Forms.Button
Me.yellow = New System.Windows.Forms.Button
Me.Green = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(88, 24)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 0
Me.Button1.Text = "Click me!"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(48, 56)
Me.TextBox1.Multiline = True
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(216, 80)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
Me.TextBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'white
'
Me.white.Location = New System.Drawing.Point(16, 184)
Me.white.Name = "white"
Me.white.Size = New System.Drawing.Size(48, 23)
Me.white.TabIndex = 2
Me.white.Text = "White"
'
'black
'
Me.black.Location = New System.Drawing.Point(80, 184)
Me.black.Name = "black"
Me.black.Size = New System.Drawing.Size(48, 23)
Me.black.TabIndex = 3
Me.black.Text = "Black"
'
'yellow
'
Me.yellow.Location = New System.Drawing.Point(144, 184)
Me.yellow.Name = "yellow"
Me.yellow.Size = New System.Drawing.Size(56, 23)
Me.yellow.TabIndex = 4
Me.yellow.Text = "Yellow"
'
'Green
'
Me.Green.Location = New System.Drawing.Point(216, 184)
Me.Green.Name = "Green"
Me.Green.Size = New System.Drawing.Size(56, 23)
Me.Green.TabIndex = 5
Me.Green.Text = "Green"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.Green)
Me.Controls.Add(Me.yellow)
Me.Controls.Add(Me.black)
Me.Controls.Add(Me.white)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Text = "Hello,welcome to the vb.net world!"
End Sub
Private Sub white_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles white.Click
TextBox1.BackColor = System.Drawing.Color.White
TextBox1.ForeColor = System.Drawing.Color.Black
End Sub
Private Sub black_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles black.Click
TextBox1.BackColor = System.Drawing.Color.Black
TextBox1.ForeColor = System.Drawing.Color.White
End Sub
Private Sub yellow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles yellow.Click
TextBox1.BackColor = System.Drawing.Color.Yellow
TextBox1.ForeColor = System.Drawing.Color.Blue
End Sub
Private Sub Green_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Green.Click
TextBox1.BackColor = System.Drawing.Color.Green
TextBox1.ForeColor = System.Drawing.Color.Red
End Sub
End Class