Condividi tramite


Proprietà IWMPControls::currentMarker

[La funzionalità associata a questa pagina, Lettore multimediale Windows SDK, è una funzionalità legacy. È stata sostituita da MediaPlayer. MediaPlayer è stato ottimizzato per Windows 10 e Windows 11. Microsoft consiglia vivamente che il nuovo codice usi MediaPlayer anziché 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à currentMarker ottiene o imposta il numero di marcatore corrente.

Sintassi

public System.Int32 currentMarker {get; set;}

Public Property currentMarker As System.Int32

Valore proprietà

Oggetto System.Int32 che corrisponde al numero di marcatore.

Commenti

L'impostazione di currentMarker causa l'avvio della riproduzione dal marcatore specificato. Prima di tentare di impostare currentMarker, determinare se un file ha marcatori e il numero di marcatori con IWMPMedia.markerCount. Se un file non dispone di marcatori, impostare currentMarker su qualsiasi elemento ma zero genera un errore. L'impostazione di currentMarker su un numero superiore a markerCount genera anche un errore.

La proprietà currentMarker restituisce sempre l'indicatore corrente o l'ultimo marcatore, il che significa che la posizione effettiva del file può essere in corrispondenza del marcatore corrente o prima del marcatore successivo. I marcatori vengono numerati a partire da 1, quindi se un file ha marcatori, è possibile impostare currentMarker su zero per modificare la posizione del file su zero.

Fino a quando non viene impostato l'elemento multimediale corrente (usando AxWindowsMediaPlayer.URL o AxWindowsMediaPlayer.currentMedia), currentMarker restituisce zero.

Esempio

Nell'esempio seguente viene usato currentMarker per avviare la riproduzione video dal marcatore che corrisponde alla proprietà SelectedIndex di una casella di riepilogo che è stata riempita con identificatori di marcatore. L'oggetto AxWMPLib.AxWindowsMediaPlayer è rappresentato dalla variabile denominata player.

// Fill the list box with the marker identifiers of the current media item.
markers.Items.Add("Begining");
markers.Items.Add("Sunrise");
markers.Items.Add("Car chase");
markers.Items.Add("Happy ending");

// Set the currentMarker to the marker selected from the list box.
private void markers_OnSelectedIndexChanged(object sender, System.EventArgs e)
{
    int selectedMarker = ((System.Windows.Forms.ListBox)sender).SelectedIndex;

    player.Ctlcontrols.currentMarker = selectedMarker;
}

' Fill the list box with the marker identifiers of the current media item.
markers.Items.Add("Begining")
markers.Items.Add("Sunrise")
markers.Items.Add("Car chase")
markers.Items.Add("Happy ending")

' Set the currentMarker to the marker selected from the list box.
Public Sub markers_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles markers.SelectedIndexChanged

    Dim lb As System.Windows.Forms.ListBox = sender
    Dim selectedMarker As Integer = lb.SelectedIndex

    player.Ctlcontrols.currentMarker = selectedMarker

End Sub

Requisiti

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

Vedi anche

AxWindowsMediaPlayer.currentMedia (VB e C#)

AxWindowsMediaPlayer.URL (VB e C#)

Interfaccia IWMPControls (VB e C#)

IWMPMedia.markerCount (VB e C#)