如何获取Windows Phone 8.1设备的实际分辨率
Windows Phone 8.1获取屏幕实际分辨率的方法与8.0有些差别,需要结合DisplayInformation(表示物理显示信息)和Window(表示当前窗体信息)这两个类并通过计算来获取。
具体代码如下:
var display = DisplayInformation.GetForCurrentView();
var width = (int)Math.Round(Window.Current.Bounds.Width * display.RawPixelsPerViewPixel);
var height = (int)Math.Round(Window.Current.Bounds.Height * display.RawPixelsPerViewPixel);