IWMPMedia::markerCount-Eigenschaft
Die markerCount-Eigenschaft ruft die Anzahl der Marker im Medienelement ab.
Diese Eigenschaft ist schreibgeschützt.
Syntax
public System.Int32 markerCount {get;}
Public ReadOnly Property markerCount As System.Int32
Eigenschaftswert
Ein System.Int32, das die Markeranzahl ist.
Bemerkungen
Diese Eigenschaft gibt 0 (null) zurück, wenn eine Datei über keine Marker verfügt oder wenn das Medienelement nicht mit dem in AxWindowsMediaPlayer.currentMedia angegebenen Element identisch ist.
Markernummern beginnen bei 1.
Bevor Sie diese Eigenschaft verwenden können, benötigen Sie Lesezugriff auf die Bibliothek. Weitere Informationen finden Sie unter Bibliothekszugriff.
Beispiele
Im folgenden Beispiel wird markerCount verwendet, um die Anzahl der Marker im aktuellen Medienelement abzurufen. Dieser Wert wird dann als Obergrenze für eine Schleifenstruktur verwendet, die die Markerliste durchläuft, um jeden Markernamen abzurufen und in einem mehrzeiligen Textfeld anzuzeigen. Das AxWMPLib.AxWindowsMediaPlayer-Objekt wird durch die Variable player dargestellt.
// Get the number of markers in the current media item.
int mcount = player.currentMedia.markerCount;
// Create an array to store the list of markers.
string[] markerNames = new string[mcount];
// Verify that at least one marker exists in the current media item.
if (mcount > 0)
{
// Loop through the marker list.
for (int i = 1; i < mcount + 1; i++)
{
// Store the marker name in the array.
markerNames[i]= player.currentMedia.getMarkerName(i);
}
// Display the marker names in the text box.
markerList.Lines = markerNames;
}
' Get the number of markers in the current media item.
Dim mcount As Integer = player.currentMedia.markerCount
' Create an array to store the list of markers.
Dim markerNames(mcount) As String
' Verify that at least one marker exists in the current media item.
If (mcount > 0) Then
' Loop through the marker list.
For i As Integer = 1 To mcount
' Store the marker name in the array.
markerNames(i) = player.currentMedia.getMarkerName(i)
Next i
' Display the marker names in the text box.
markerList.Lines = markerNames
End If
Requirements (Anforderungen)
| Anforderung | Wert |
|---|---|
| Version |
Windows Media Player 9er Serie oder höher |
| Namespace |
WMPLib |
| Assembly |
|