如何阻止 AxWindowsMediaPlayer 接受 C# 中的任何用户命令
在我的演示代码中,嵌入式 Windows 媒体播放器开始加载并播放视频。播放器不显示任何控件,所有其他选项均为默认选项。到目前为止这有效。
不起作用的是并非所有用户交互都被停止。例如,可以通过双击将模式更改为全屏,也可以通过右键单击获得完整的上下文。
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
axWindowsMediaPlayer1.uiMode = "none";
}
private void button1_Click(object sender, EventArgs e)
{
axWindowsMediaPlayer1.URL = @"C:\stackoverflow.mp4";
}
}
如何将播放器与用户隔离并仅通过代码控制播放器?
In my democode an embeded windows media player starts to load and play a video. The player shows no controls, all other options are the default options. So far this works.
What does not work is that not all userinteraction is stopped. For instance it is possible to change the mode to fullscreen with a doubleclick and it also is possible to get a full context with a right click.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
axWindowsMediaPlayer1.uiMode = "none";
}
private void button1_Click(object sender, EventArgs e)
{
axWindowsMediaPlayer1.URL = @"C:\stackoverflow.mp4";
}
}
How can i isolate the player from the user and only control the player via code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一个朋友刚刚帮我解决了这个问题。
禁用上下文菜单相当容易
禁用双击需要消息过滤器 - 网上已经有解决方案。
我重写了我的示例,现在使用此代码:
特别感谢我的匿名朋友和来自 Microsoft 开发者网络 Frorums 的“remarkpk11”。
代码存在一些较小的问题 - 我不喜欢消息一开始就对我隐藏,我也希望摆脱两个全局依赖项 Cursor 和 Application。但就这个问题而言,我认为它已经得到解答。
A friend just helped me to solve this.
Disabling the context menü was rather easy
Disabling the doubleclick requires a message filter - there is already a solution on the web.
I have rewritten my example and i am now using this code:
Special thanks to my unnamed friend and to "remarkpk11" from the Microsoft Developer Network Frorums.
There are some smaller issues with the code - i dont like that the Messages are hidden from me in the first place and i also would love to get rid of the two global dependencies Cursor and Application. But as far as this question goes i consider it answered.
尝试
axWindowsMediaPlayer1.Ctlenabled = False
编辑:抱歉,这是针对 vb 的。
try
axWindowsMediaPlayer1.Ctlenabled = False
EDIT: sorry, this is for vb..