Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(71, 47)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(75, 23)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
Me.Button1.UseVisualStyleBackColor = True
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(425, 354)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
Friend WithEvents Button1 As System.Windows.Forms.Button
Code (VB.NET)
Public Class Form1
Private Sub Button2_Click(sender As Object, e As EventArgs)
Dim btn As Button = CType(sender, Button)
btn.BackColor = Color.Blue
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
AddHandler Button1.Click, AddressOf Button2_Click
End Sub
End Class
ได้แค่นี้ไปเล่นก็ต่อได้เยอะอ่าครับ
จะเปลี่ยน text ใส่รูป ย้ายไปย้ายมาก็ได้หมดครับ(ขึ้นอยู่กับการมองของเราเอง )