在 wpf 中运行视频
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13967539/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Run video in wpf
提问by Chakavak Behzad
I want my first project to be implemented in the form of a video, how do I do this? I want to play a video and then when I click on the form, video get stopped and app go to another page. please help me.
我想以视频的形式实施我的第一个项目,我该怎么做?我想播放一个视频,然后当我点击表单时,视频停止并且应用程序转到另一个页面。请帮我。
回答by makc
try using MediaElement
尝试使用 MediaElement
<MediaElement Name="VideoControl"
Source="C:\my.wmv" >
</MediaElement>
回答by Ionic? Biz?u
Using MediaElementcontrol you will can play a video in WFP.
XAML code:
使用MediaElement控件,您可以在 WFP 中播放视频。XAML 代码:
<MediaElement Name="VideoControl" Width="200" Height ="400"
Source="your_path_to_video_file.wmv" >
</MediaElement>
It plays MPG files, too: Source="C:\TestV.MPG"
它也播放 MPG 文件: Source="C:\TestV.MPG"
To know how to control it using Play, Stop, Pause buttons click here. It's a good article about this with many examples.
要了解如何使用播放、停止、暂停按钮来控制它,请单击此处。这是一篇关于这个的好文章,有很多例子。
回答by Yugz
Its pretty simple just use the MediaElement control in wpf to display your video on your form
它非常简单,只需使用 wpf 中的 MediaElement 控件即可在表单上显示您的视频

