BackgroundWorker.ProgressChanged 事件

定义

调用 ReportProgress(Int32) 时发生。

public:
 event System::ComponentModel::ProgressChangedEventHandler ^ ProgressChanged;
public event System.ComponentModel.ProgressChangedEventHandler ProgressChanged;
public event System.ComponentModel.ProgressChangedEventHandler? ProgressChanged;
member this.ProgressChanged : System.ComponentModel.ProgressChangedEventHandler 
Public Custom Event ProgressChanged As ProgressChangedEventHandler 

事件类型

示例

下面的代码示例演示如何使用 ProgressChanged 事件向用户报告异步操作的进度。 此代码示例是为 BackgroundWorker 类提供的一个更大示例的一部分。

// This event handler updates the progress bar.
void backgroundWorker1_ProgressChanged( Object^ /*sender*/, ProgressChangedEventArgs^ e )
{
   this->progressBar1->Value = e->ProgressPercentage;
}
// This event handler updates the progress bar.
private void backgroundWorker1_ProgressChanged(object sender,
    ProgressChangedEventArgs e)
{
    this.progressBar1.Value = e.ProgressPercentage;
}
' This event handler updates the progress bar.
Private Sub backgroundWorker1_ProgressChanged( _
ByVal sender As Object, ByVal e As ProgressChangedEventArgs) _
Handles backgroundWorker1.ProgressChanged

    Me.progressBar1.Value = e.ProgressPercentage

End Sub

注解

调用 方法时会引发此 ReportProgress 事件。

有关如何处理事件的详细信息,请参阅 处理和引发事件

适用于

另请参阅