Share via


Proprietà IWMPControls::currentPositionString

[La funzionalità associata a questa pagina, Lettore multimediale Windows SDK, è una funzionalità legacy. È stato sostituito da MediaPlayer. MediaPlayer è stato ottimizzato per Windows 10 e Windows 11. Microsoft consiglia vivamente che il nuovo codice usi MediaPlayer invece di Lettore multimediale Windows SDK, quando possibile. Microsoft suggerisce che il codice esistente che usa le API legacy venga riscritto per usare le nuove API, se possibile.

La proprietà currentPositionString ottiene la posizione corrente nell'elemento multimediale come stringa formattata come HH:MM:SS (ore, minuti e secondi).

Questa proprietà è di sola lettura.

Sintassi

public System.String currentPositionString {get;}

Public ReadOnly Property currentPositionString As System.String

Valore proprietà

Oggetto System.String formattato che rappresenta la posizione corrente.

Commenti

Se l'elemento multimediale è inferiore a un'ora, la posizione corrente viene formattata come MM:SS (minuti e secondi).

Esempio

Nell'esempio seguente viene avviato un timer che attiva un evento a intervalli di un secondo. Nel gestore eventi timer, un'etichetta viene aggiornata con currentPositionString. L'oggetto AxWMPLib.AxWindowsMediaPlayer è rappresentato dalla variabile denominata player.

// Set the timer to fire an event every second and start the timer.
timer.Interval = 1000;
timer.Start();

// Note:  Use the AxWindowsMediaPlayer.PlayStateChange event with a switch statement to
// determine when to start and stop the timer. 
   
// Update the text of the label with the currentPositionString.
private void TimerEventProcessor(object sender, System.EventArgs e)
{
    currentPositionLabel.Text = player.Ctlcontrols.currentPositionString;
}

' Set the timer to fire an event every second and start the timer.
timer.Interval = 1000
timer.Start()

' Note:  Use the AxWindowsMediaPlayer.PlayStateChange event with a switch statement to
' determine when to start and stop the timer. 

' Update the text of the label with the currentPositionString.
Public Sub TimerEventProcessor(ByVal sender As Object, ByVal e As System.EventArgs) Handles timer.Tick

    currentPositionLabel.Text = player.Ctlcontrols.currentPositionString

End Sub

Requisiti

Requisito Valore
Versione
Lettore multimediale Windows serie 9 o successive
Spazio dei nomi
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

Vedi anche

Interfaccia IWMPControls (VB e C#)

IWMPControls.currentPosition (VB e C#)