主线程中点击某button(name为simpleButtonCopy)
public delegate void NoObjectDel();
private void simpleButtonCopy_Click(object sender, EventArgs e)
{
this.simpleButtonCopy.Enabled = false;
this.simpleButtonCopy.Text = "复制中...";
Thread t1 = new Thread(new ThreadStart(CopyPics));
t1.Start();
}
线程运行函数
private void CopyPics()
{
if (this.simpleButtonCopy.InvokeRequired)
{
BeginInvoke(new NoObjectDel(FinishCopyPics));
}
else
{
FinishCopyPics();
}
}
private void FinishCopyPics()
{
this.simpleButtonCopy.Text = "复制";