C# 託管中傳遞參數

public
 delegate void
 MyDelegate(Label myControl, string
 myArg2);

private void Button_Click(object sender, EventArgs e)
{
object[] myArray = new object[2];

myArray[0] = new Label();
myArray[1] = "Enter a Value" ;
myTextBox.BeginInvoke(new MyDelegate(DelegateMethod), myArray);
}

public void DelegateMethod(Label myControl, string myCaption)
{
myControl.Location = new Point(16,16);
myControl.Size = new Size(80, 25);
myControl.Text = myCaption;
this .Controls.Add(myControl);
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章