【发布时间】:2015-07-13 14:33:38
【问题描述】:
我正在使用 MediaCapture 创建一个相机应用程序。我正在尝试适应屏幕旋转,因此我创建了以下方法:
private void Current_SizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs e)
{
width = Window.Current.Bounds.Width;
height = Window.Current.Bounds.Height;
//captureManager.SetPreviewRotation(VideoRotation.Clockwise90Degrees);
//if (ApplicationView.GetForCurrentView().Orientation.ToString() == "Portrait") capturePreview.Stretch = Stretch.Fill;
capturePreview.Width = width;
capturePreview.Height = height;
imagePreview.Width = width;
imagePreview.Height = height;
//if (ApplicationView.GetForCurrentView().Orientation.ToString() == "Portrait") capturePreview.Stretch = Stretch.Fill;
//else capturePreview.Stretch = Stretch.Uniform;
}
当我打开我的应用程序时,相机会填满整个页面,但是当我翻转相机时,capturePreview 只占用页面的一半,无论我以纵向模式还是水平模式启动应用程序,其他模式都不会'不工作,但如果切换到第一种模式也可以。
另一个问题是关于实际的 capturePreview 布局,我发现如果我将屏幕保持在水平布局,相机效果很好,但如果设备处于纵向模式,我无法在不拉伸照片的情况下填满整个页面,有没有办法为了在屏幕上只保留一个元素以一定的旋转(capturePreview),我尝试使用旋转变换来旋转它,但这也会影响元素的实际位置。 谢谢
【问题讨论】:
标签: c# windows-phone-8.1 screen-rotation