Пример #1
0
        public static Int32 PixelsPerInch(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
        internal static int PixelsPerInch(Orientation orientation)
        {
            int nIndex = (orientation == Orientation.Horizontal ?
                          NativeMethods.LOGPIXELSX :
                          NativeMethods.LOGPIXELSY);

            using (DCSafeHandle screenDC = UnsafeNativeMethods.CreateDC(DISPLAY))
            {
                return(screenDC.IsInvalid ? defaultPixelsPerInch :
                       UnsafeNativeMethods.GetDeviceCaps(screenDC, nIndex));
            }
        }
Пример #3
0
 public static extern Int32 GetDeviceCaps(DCSafeHandle hDC, Int32 nIndex);