示例#1
0
        /// <summary>
        /// システムから画面の DPI 設定を取得します。
        /// </summary>
        /// <param name="orientation">画面の方向</param>
        /// <returns></returns>
        public static Int32 GetDpi(Orientation orientation)
        {
            Int32 capIndex = (orientation == Orientation.Horizontal) ? 0x58 : 90;

            using (DCSafeHandle handle = UnsafeNativeMethods.CreateDC("DISPLAY"))
            {
                return(handle.IsInvalid ? 0x60 : UnsafeNativeMethods.GetDeviceCaps(handle, capIndex));
            }
        }
示例#2
0
 public static extern Int32 GetDeviceCaps(DCSafeHandle hDC, Int32 nIndex);