当我使用 UniformToFill 拉伸时,为什么我的媒体元素不能正确填充屏幕?如果窗口比 mediaElement 宽,mediaElement 在底部剪辑,如果窗口比 mediaElement 高,它在右侧剪辑。
<Window x:Class="WpfApplication1.Window3"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Preview Window" Height="200" Width="600" WindowStyle="None" Background="Black" ResizeMode="CanMinimize" MouseLeftButtonDown="Window3_MouseLeftButtonDown" HorizontalAlignment="Left" VerticalAlignment="Top">
<Grid Focusable="False">
<MediaElement Name="mediaElement2" LoadedBehavior="Manual" MediaOpened="mediaElement2_MediaOpened" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="289,-19,-11,-19" />
<MediaElement Name="mediaElement1" LoadedBehavior="Manual" MediaOpened="mediaElement1_MediaOpened" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="-11,0,289,0"/>
</Grid>
在程序中,我使用这些命令来拉伸它并使用视觉画笔将这些视频应用到另一个窗口。此问题出现在视频/图片剪辑不正确的窗口中
window3.mediaElement1.Stretch = Stretch.UniformToFill;
window3.mediaElement2.Stretch = Stretch.UniformToFill;