C#.NET 动态参数
作者:fovly 日期:2009-10-15
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);
}
===================================
private delegate int MyMethod();
private void MethodCompleted(IAsyncResult asyncResult)
{
if (asyncResult == null) return;
textBox1.Text = (asyncResult.AsyncState as MyMethod).EndInvoke(asyncResult).ToString();//RefreshOutputFiles()方法返回的结果;
}
private void det_OnFinishedEvent()
{
MyMethod my = RefreshOutputFiles;
IAsyncResult asyncResult = my.BeginInvoke(MethodCompleted, my);
this.BeginInvoke();
}
评论: 0 | 引用: 0 | 查看次数: 349
上一篇
下一篇


文章来自:
Tags:
:805936076






