如何从Windows Phone 8.1上的设备获得缩放分辨率(480×800或480×853)?我有一些测试手机:
答案 0 :(得分:0)
你可以使用
DisplayInformation di = DisplayInformation.GetForCurrentView();
ResolutionScale rs = di.ResolutionScale;
ResolutionScale将为您提供比例因子: 1. ResolutionScale.Scale100Percent: 2. ResolutionScale.Scale140Percent: 3. ResolutionScale.Scale180Percent:
通过以下有用链接以获得更清晰:
http://channel9.msdn.com/Events/Build/2014/3-541
修改强>
var rawpixelperview = Windows.Graphics.Display.DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;
var Width = Convert.ToInt32(Window.Current.Bounds.Width * rawpixelperview);
var Height = Convert.ToInt32(Window.Current.Bounds.Height * rawpixelperview);
if(Width == 480 && Height == 800)
{
// logic here for this scale
}
else if((Width == 720 && Height == 1280 ) || (Width == 768 && Height == 1280))
{
// logic here for this scale
}
else
{
// logic here for this scale
}