我指的是 MSDN 上的这个文档。我了解“.BeginInvoke”的作用,但是查看文档上的示例代码
Delegate Sub MyDelegate(myControl As Label, myArg2 As String)
Private Sub Button_Click(sender As Object, e As EventArgs)
Dim myArray(1) As Object
myArray(0) = New Label()
myArray(1) = "Enter a Value"
myTextBox.BeginInvoke(New MyDelegate(AddressOf DelegateMethod), myArray)
End Sub 'Button_Click
Public Sub DelegateMethod(myControl As Label, myCaption As String)
myControl.Location = New Point(16, 16)
myControl.Size = New Size(80, 25)
myControl.Text = myCaption
Me.Controls.Add(myControl)
End Sub 'DelegateMethod
委托 myDelegate(和 DelegateMethod)接受一个控件和一个字符串,但是,在 .BeginInvoke 处,传递了一个 Label 控件和一个数组......
myTextBox.BeginInvoke(New MyDelegate(AddressOf DelegateMethod), myArray)
在“DelegateMethod”中有
myControl.Text = myCaption
不应该传递字符串而不是数组吗?我错过了什么吗?