我有这样的方法:
Public Sub CreateEditbox(sender As Object)
ListBox1 = DirectCast(sender, ListBox)
itemSelected = ListBox1.SelectedIndex
Dim r As Rectangle = ListBox1.GetItemRectangle(itemSelected)
Dim itemText As String = DirectCast(ListBox1.Items(itemSelected), String)
EditBox.Location = New System.Drawing.Point(r.X + 15, r.Y + 15)
EditBox.Size = New System.Drawing.Size(r.Width - 15, r.Height)
editBox.Show()
ListBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.editBox})
editBox.Text = itemText
editBox.Focus()
editBox.SelectAll()
AddHandler EditBox.KeyPress, AddressOf EditOver
AddHandler EditBox.LostFocus, AddressOf FocusOver
End Sub
现在我希望能够从 buttonclick 调用此方法,我只是不太确定如何从 buttonclick 事件获取列表框的发送者数据,如方法的第一行所示。有任何想法吗?
此致,
约翰