IWMPControls :: currentPositionString, propriété

La propriété currentPositionString obtient la position actuelle dans l’élément multimédia sous la forme d’une chaîne au format hh : mm : SS (heures, minutes et secondes).

Cette propriété est en lecture seule.

Syntaxe

public System.String currentPositionString {get;}

Public ReadOnly Property currentPositionString As System.String

Valeur de la propriété

System. String mis en forme qui correspond à la position actuelle.

Notes

Si l’élément multimédia a une valeur inférieure à une heure, la position actuelle est au format MM : SS (minutes et secondes).

Exemples

L’exemple suivant démarre une minuterie qui déclenche un événement à intervalles d’une seconde. Dans le gestionnaire d’événements du minuteur, une étiquette est mise à jour avec currentPositionString. L’objet AxWMPLib. AxWindowsMediaPlayer est représenté par la variable 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

Spécifications

Condition requise Valeur
Version
Lecteur Windows Media série 9 ou version ultérieure
Espace de noms
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

Voir aussi

Interface IWMPControls (VB et C#)

IWMPControls. currentPosition (VB et C#)