/// <summary>
/// 任务委托
/// </summary>
delegate void TaskDelegate();
/// <summary>
/// 任务
/// </summary>
public void Task()
{
}
// 开始异步Task
TaskDelegate task = new TaskDelegate(Task);
task.BeginInvoke(null, null);
/// <summary>
/// 更新界面委托
/// </summary>
private delegate void ProgressEventsHandler( object sender, ProgressEventArgs e);
/// <summary>
/// 更新界面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void UpdateUI(object sender, ProgressEventArgs e)
{
//改变进度条位置
progressBar1.Value += e.PercentIncrease1;
}
object[] pList = { this, e };
BeginInvoke(new ProgressEventsHandler(UpdateUI), pList);
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240826070647288-243310440.jpg)