标签:
更改电脑屏幕显示的文字大小后,平面显示区域问题。
/// <summary> /// 屏幕显示尺寸 /// </summary> public static Size ReviseScreenSize { get { float pixels = getLogPiex(); float dxPrecent = 96 / pixels; //pixels / 96; Screen s = Screen.PrimaryScreen; Size primarySize = s.Bounds.Size; Size returnSize = new Size(); returnSize.Width = (int)(primarySize.Width * dxPrecent); returnSize.Height = (int)(primarySize.Height * dxPrecent); return returnSize; } } public static float getLogPiex() { float returnValue = 96; RegistryKey key = Registry.CurrentUser; RegistryKey pixeKey = key.OpenSubKey("Control Panel\\Desktop"); if (pixeKey != null) { var pixels = pixeKey.GetValue("LogPixels"); if (pixels != null) { returnValue = float.Parse(pixels.ToString()); } pixeKey.Close(); } return returnValue; }
标签:
原文地址:http://www.cnblogs.com/shenchao/p/5465533.html