我正在开发 Windows 8.1 应用程序,目前我正在努力获取以英寸或任何其他测量单位为单位的实际屏幕尺寸。
是否有可能获得该信息?
var bounds = Window.Current.Bounds;
double w = bounds.Width;
double h = bounds.Height;
switch (DisplayProperties.ResolutionScale)
{
case ResolutionScale.Scale140Percent:
w = Math.Ceiling(w * 1.4);
h = Math.Ceiling(h * 1.4);
break;
case ResolutionScale.Scale180Percent:
w = Math.Ceiling(w * 1.8);
h = Math.Ceiling(h * 1.8);
break;
}
Size resolution = new Size(w, h);