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)); } }
public static extern Int32 GetDeviceCaps(DCSafeHandle hDC, Int32 nIndex);