Public Class Form1
Dim mybutton As Button
Dim myText As TextBox
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Width = 400
Me.Height = 210
Me.Text = "실행중 생성된 버튼 이벤트 실행"
For i As Integer = 1 To 5
mybutton = New Button
With mybutton
.Name = "Button" + i.ToString
.Text = "올려보세여"
.Top = 25 * i
.Left = 10
.Width = 100
AddHandler .MouseHover, AddressOf Button_MouseHover
Me.Controls.Add(mybutton)
End With
Next
myText = New TextBox
With myText
.Top = 25
.Left = 150
.Width = 200
.Height = 125
.Multiline = True
.ScrollBars = ScrollBars.Vertical
Me.Controls.Add(myText)
End With
End Sub
Public Class Form1 Dim mybutton As Button Dim myText As TextBox
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Me.Width = 400 Me.Height = 210 Me.Text = "실행중 생성된 버튼 이벤트 실행"
For i As Integer = 1 To 5 mybutton = New Button With mybutton .Name = "Button" + i.ToString .Text = "올려보세요" .Top = 25 * i .Left = 10 .Width = 100
AddHandler .MouseHover, AddressOf Button_mousehover Me.Controls.Add(mybutton) End With Next
myText = New TextBox With myText .Top = 25 .Left = 150 .Width = 200 .Height = 125 .Multiline = True .ScrollBars = ScrollBars.Vertical Me.Controls.Add(myText) End With End Sub
Private Sub Button_MouseHover(sender As System.Object, e As System.EventArgs) Handles MyBase.MouseHover myText.Text &= "마우스는" & sender.name & "위에 있습니다" & vbCrLf End Sub End Class
Public Class Form1
Dim mybutton As Button
Dim myText As TextBox
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.Width = 400
Me.Height = 210
Me.Text = "실행중 생성된 버튼 이벤트 실행"
For i As Integer = 1 To 5
mybutton = New Button
With mybutton
.Name = "Button" + i.ToString
.Text = "올려보세요"
.Top = 25 * i
.Left = 10
.Width = 100
AddHandler .MouseHover, AddressOf Button_mousehover
Me.Controls.Add(mybutton)
End With
Next
myText = New TextBox
With myText
.Top = 25
.Left = 150
.Width = 200
.Height = 125
.Multiline = True
.ScrollBars = ScrollBars.Vertical
Me.Controls.Add(myText)
End With
End Sub
Private Sub Button_MouseHover(sender As System.Object, e As System.EventArgs) Handles MyBase.MouseHover
myText.Text &= "마우스는" & sender.name & "위에 있습니다" & vbCrLf
End Sub
End Class
이 댓글을