[UWP]是否可以获得视图的最大工作区大小? [英] [UWP] Is it possible to get the max work area size for a view?

查看:123
本文介绍了[UWP]是否可以获得视图的最大工作区大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用  TryResizeView()调整视图大小以适应工作区域,但保持宽高比。有没有办法在当前屏幕上获取工作区的大小,以便我可以计算所需的大小?

I'm trying to resize a view using TryResizeView() to fit inside the work area, but keeping the aspect ratio. Is there any way to get the size of the work area on the current screen so that I can compute the desired size?

推荐答案

你好iohanson,

Hello iohanson,

似乎我找不到计算某种尺寸的直接方法。我可以尝试以下方法来获得屏幕分辨率:

It seems I cannot find a direct way to compute some size. I can try the following to get the screen resolution:

 ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
var bounds = ApplicationView.GetForCurrentView().VisibleBounds;
            var scaleFactor = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;
            var size = new Size(bounds.Width * scaleFactor, bounds.Bottom * scaleFactor);

我能否理解你的工作区域是FullScreen-BottomBar ?还是其他什么?

Can I understand that your working area is the FullScreen-BottomBar? Or anything else?

祝你好运,

Barry


这篇关于[UWP]是否可以获得视图的最大工作区大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆