IWMPControls::currentPosition 属性
[与此页面关联的功能(Windows 媒体播放器 SDK)是旧版功能。 它已被 MediaPlayer 取代。 MediaPlayer 已针对Windows 10和Windows 11进行了优化。 如果可能,Microsoft 强烈建议新代码使用 MediaPlayer 而不是 Windows 媒体播放器 SDK。 如果可能,Microsoft 建议重写使用旧 API 的现有代码以使用新 API。]
currentPosition 属性获取或设置媒体项中当前位置(以秒为单位)。
语法
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 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈