SoundPlayer.SoundLocationChanged 事件

定义

当已设置此 SoundPlayer 的新音频源路径时出现。

public:
 event EventHandler ^ SoundLocationChanged;
public event EventHandler SoundLocationChanged;
public event EventHandler? SoundLocationChanged;
member this.SoundLocationChanged : EventHandler 
Public Custom Event SoundLocationChanged As EventHandler 

事件类型

EventHandler

示例

下面的代码示例演示了当 OnSoundLocationChanged 已附加到其他 .wav 文件时使用事件处理程序接收通知 SoundPlayer 。 此代码示例是为类提供的大型示例的 SoundPlayer 一部分。

// Handler for the SoundLocationChanged event.
void player_LocationChanged( Object^ /*sender*/, EventArgs^ /*e*/ )
{
   String^ message = String::Format( "SoundLocationChanged: {0}", player->SoundLocation );
   ReportStatus( message );
}
// Handler for the SoundLocationChanged event.
private void player_LocationChanged(object sender, EventArgs e)
{   
    string message = String.Format("SoundLocationChanged: {0}", 
        player.SoundLocation);
    ReportStatus(message);
}
' Handler for the SoundLocationChanged event.
Private Sub player_LocationChanged(ByVal sender As Object, _
    ByVal e As EventArgs)
    Dim message As String = [String].Format("SoundLocationChanged: {0}", _
        player.SoundLocation)
    ReportStatus(message)
End Sub

注解

设置此事件的新音频源路径时,将引发此 SoundPlayer 事件。

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

适用于

另请参阅