如何使用 C# 最大化 UWP 项目中的窗口(不是全屏!)?我尝试使用窗口边界作为参数的 TryResizeView 方法,但没有任何反应。
Thanks
目前在 UWP 中这是不可能的。所以,我无法让你最大化,但我可以让你非常接近:
var av = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView();
var di = Windows.Graphics.Display.DisplayInformation.GetForCurrentView();
var bounds = av.VisibleBounds;
var factor = di.RawPixelsPerViewPixel;
var size = new Windows.Foundation.Size(bounds.Width * factor, bounds.Height * factor);
size.Height -= 100;
size.Width -= 100;
av.TryResizeView(size);
基本上,减去 100(考虑到任务)。这在大多数情况下都有效,但如果没有真正的屏幕边界测量,我认为这是我们现在能做的最好的事情。抱歉我不能给你更多。任务栏的大小(和位置)是变量。
这是在http://aka.ms/template10 http://aka.ms/template10 (https://github.com/Windows-XAML/Template10/blob/master/Template10%20(Library)/Utils/MonitorUtils.cs#L58 https://github.com/Windows-XAML/Template10/blob/master/Template10%20(Library)/Utils/MonitorUtils.cs#L58)
祝你好运!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)