简体   繁体   English

在WPF MediaElement中缩放视频

[英]Zoom Video in WPF MediaElement

I like to zoom a video which I play with MediaElement to ie 150% but keep the MediaElement Size fixed. 我喜欢将使用MediaElement播放的视频缩放到150%,但保持MediaElement Size固定。 This should only show the center of the video on the screen ie like a wide screen movie on a 4:3 screen without black bars on the top and bottom. 这仅应在屏幕上显示视频的中心,即像4:3屏幕上的宽屏电影一样,顶部和底部没有黑条。
How can I do this? 我怎样才能做到这一点? I checked the MediaElement class and I didn't find anything like zoom. 我检查了MediaElement类,但没有找到缩放之类的东西。 https://msdn.microsoft.com/en-us/library/system.windows.controls.mediaelement(v=vs.110).aspx https://msdn.microsoft.com/zh-CN/library/system.windows.controls.mediaelement(v=vs.110).aspx

Add the media element to a canvas 将媒体元素添加到画布

                mediaelement.Width = canvas.Width;
                mediaelement.Height = canvas.Height;
                mediaelement.Stretch = Stretch.Fill;

For zooming the canvas check the link Canvas zooming 要缩放画布,请检查链接画布缩放

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM