共用方式為


SoundPlayer.LoadCompleted 事件

定義

當.wav 檔載入成功或載入失敗時都會發生。

public:
 event System::ComponentModel::AsyncCompletedEventHandler ^ LoadCompleted;
public event System.ComponentModel.AsyncCompletedEventHandler LoadCompleted;
public event System.ComponentModel.AsyncCompletedEventHandler? LoadCompleted;
member this.LoadCompleted : System.ComponentModel.AsyncCompletedEventHandler 
Public Custom Event LoadCompleted As AsyncCompletedEventHandler 

事件類型

範例

下列程式代碼範例示範如何使用 OnLoadCompleted 事件處理程式來接收通知,指出已載入.wav檔案的內容。 此程式代碼範例是提供給 類別之較大範例的 SoundPlayer 一部分。

// Handler for the LoadCompleted event.
void player_LoadCompleted( Object^ /*sender*/, AsyncCompletedEventArgs^ /*e*/ )
{
   String^ message = String::Format( "LoadCompleted: {0}", this->filepathTextbox->Text );
   ReportStatus( message );
   EnablePlaybackControls( true );
}
// Handler for the LoadCompleted event.
private void player_LoadCompleted(object sender, 
    AsyncCompletedEventArgs e)
{   
    string message = String.Format("LoadCompleted: {0}", 
        this.filepathTextbox.Text);
    ReportStatus(message);
    EnablePlaybackControls(true);
}
' Handler for the LoadCompleted event.
Private Sub player_LoadCompleted(ByVal sender As Object, _
    ByVal e As AsyncCompletedEventArgs)

    Dim message As String = [String].Format("LoadCompleted: {0}", _
        Me.filepathTextbox.Text)
    ReportStatus(message)
    EnablePlaybackControls(True)

End Sub

備註

載入.wav檔案完成時,就會引發此事件。 事件自變數會指出音效的負載是否已順利完成或失敗。

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

適用於

另請參閱