Windows phone 7 如何获得wp7 ppi或物理屏幕大小?
我正在为wp7创建(另一个)标尺应用程序 我知道分辨率总是480x800,但设备的屏幕大小不同 我试着四处搜索,但我找不到如何获得ppi,所以我可以将像素映射到物理维度Windows phone 7 如何获得wp7 ppi或物理屏幕大小?,windows-phone-7,screen,Windows Phone 7,Screen,我正在为wp7创建(另一个)标尺应用程序 我知道分辨率总是480x800,但设备的屏幕大小不同 我试着四处搜索,但我找不到如何获得ppi,所以我可以将像素映射到物理维度 那么,如何获取当前设备的ppi或物理屏幕大小?无法检索设备上的ppi,最好的办法是维护设备及其各自ppi的列表。您可以使用此帮助器方法访问设备属性: Using Microsoft.Phone.Info; ... private static string GetDeviceProperty(string propertyNam
那么,如何获取当前设备的ppi或物理屏幕大小?无法检索设备上的ppi,最好的办法是维护设备及其各自ppi的列表。您可以使用此帮助器方法访问设备属性:
Using Microsoft.Phone.Info;
...
private static string GetDeviceProperty(string propertyName)
{
object propertyValue;
if (!DeviceExtendedProperties.TryGetValue(propertyName, out propertyValue))
return String.Empty;
return propertyValue as string ?? String.Empty;
}
现在,相关属性将是:
string manufacturer = GetDeviceProperty("DeviceManufacturer");
string devicename = GetDeviceProperty("DeviceName");
希望这有帮助!有关DeviceExtendedProperties的更多信息,请访问,这是我的做法。很高兴Windows手机的数量没有机器人那么多!;)我担心这是唯一的办法。不幸的是,这不能很好地扩展。无论如何,谢谢你。