委托最简便的方法

//委托的最简便的写法
this.Invoke(new Action(() =>
{
    //这里面写需要进行的委托操作
    //比如线程操作界面的语句等
}));


//举例
this.Invoke(new Action(() =>
{
    this.TextBox1.Text = "12345";
}));

//举例
this.Invoke(new Action(() =>
{
    this.ListBox1.SelectedIndex = 0;
}));

 

posted @ 2018-01-25 10:59  大漠苍狼~  阅读(141)  评论(0编辑  收藏  举报