Udostępnij przez


SoundPlayer.SoundLocation Właściwość

Definicja

Pobiera lub ustawia ścieżkę pliku lub adres URL pliku .wav do załadowania.

public:
 property System::String ^ SoundLocation { System::String ^ get(); void set(System::String ^ value); };
public string SoundLocation { get; set; }
member this.SoundLocation : string with get, set
Public Property SoundLocation As String

Wartość właściwości

Ścieżka pliku lub adres URL, z którego można załadować plik .wav lub Empty jeśli nie ma żadnej ścieżki pliku. Wartość domyślna to Empty.

Przykłady

Poniższy przykład kodu przedstawia użycie SoundLocation właściwości w celu przypisania źródła pliku .wav do wystąpienia SoundPlayer klasy. Ten przykład kodu jest częścią większego przykładu podanego SoundPlayer dla klasy.

try
{
   
   // Assign the selected file's path to 
   // the SoundPlayer object.  
   player->SoundLocation = filepathTextbox->Text;
   
   // Load the .wav file.
   player->Load();
}
catch ( Exception^ ex ) 
{
   ReportStatus( ex->Message );
}
try
{
    // Assign the selected file's path to 
    // the SoundPlayer object.  
    player.SoundLocation = filepathTextbox.Text;

    // Load the .wav file.
    player.Load();
}
catch (Exception ex)
{
    ReportStatus(ex.Message);
}
Try
    ' Assign the selected file's path to the SoundPlayer object.
    player.SoundLocation = filepathTextbox.Text

    ' Load the .wav file.
    player.Load()
Catch ex As Exception
    ReportStatus(ex.Message)
End Try

Uwagi

Ta właściwość jest ustawiana na String.Empty wartość , gdy Stream właściwość jest ustawiona na Streamwartość .

Dotyczy

Zobacz też