IWMPControls::currentPosition 屬性
[與此頁面相關聯的功能Windows 媒體播放機 SDK是舊版功能。 MediaPlayer已取代它。 MediaPlayer已針對Windows 10和Windows 11進行優化。 Microsoft 強烈建議新程式碼盡可能使用MediaPlayer,而不是Windows 媒體播放機 SDK。 Microsoft 建議使用舊版 API 的現有程式碼盡可能重寫為使用新的 API。
currentPosition屬性會取得或設定媒體專案中的目前位置,以秒為單位從頭開始。
Syntax
public System.Double currentPosition {get; set;}
Public Property currentPosition As System.Double
屬性值
System.Double,這是目前的位置。
範例
下列範例會使用 currentPosition 來搜尋使用者提供的位置。 為了回應按鈕按一下,currentPosition 會設定為在名為 newPosition 的文字方塊中輸入的值。 AxWMPLib.AxWindowsMediaPlayer物件是由名為 player 的變數表示。
private void setPosition_Click(object sender, System.EventArgs e)
{
// ...Add code to ensure that the text box contains a valid value.
// Set the current position of the media item to the position entered by the user.
player.Ctlcontrols.currentPosition = Convert.ToDouble(newPosition.Text);
}
Public Sub setPosition_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles setPosition.Click
' ...Add code to ensure that the text box contains a valid value.
' Set the current position of the media item to the position entered by the user.
player.Ctlcontrols.currentPosition = Convert.ToDouble(newPosition.Text)
End Sub
規格需求
需求 | 值 |
---|---|
版本 |
Windows 媒體播放機 9 系列或更新版本 |
命名空間 |
WMPLib |
組件 |
|
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應