共用方式為


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 方法時,就會引發此事件。

如需如何處理事件的詳細資訊,請參閱 處理和引發事件

適用於

另請參閱