在 Form 上 用 Code 增加 / 建立 有 Event 既 GUI Object |
Public Class Form1 Friend WithEvents AA As New Button Friend WithEvents BB As New TextBox Friend WithEvents CC As New Label Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AA.Parent = Me AA.Name = "AA" AA.Visible = True AA.Text = "" AA.Size = New System.Drawing.Size(75, 50) AA.Location = New System.Drawing.Point(75, 50) BB.Parent = Me BB.Name = "BB" BB.Visible = True BB.Text = "" BB.Size = New System.Drawing.Size(75, 50) BB.Location = New System.Drawing.Point(75, 150) CC.Parent = Me CC.Name = "CC" CC.Visible = True CC.Text = "" CC.Size = New System.Drawing.Size(75, 50) CC.Location = New System.Drawing.Point(75, 250) Intial() End Sub Private Sub Intial() AA.Text = "Intial" BB.Text = "Intial" CC.Text = "Intial" End Sub Private Sub A_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AA.Click BB.Text = "After Event" CC.Text = "After Event" End Sub End Class |