public static int GetDeviceCaps(DeviceCap cap) { using (var g = Graphics.FromHwnd(IntPtr.Zero)) { //Console.WriteLine("Graphics.DpiX: " + g.DpiX); //Console.WriteLine("Graphics.DpiY: " + g.DpiY); //Console.WriteLine(); //var hdc = new HandleRef(g, g.GetHdc()); IntPtr hdc = g.GetHdc(); int result = GetDeviceCaps(hdc, (int)cap); g.ReleaseHdc(); return(result); } }
internal static extern int GetDeviceCaps(IntPtr hdc, DeviceCap capindex);
private static extern int GetDeviceCaps(IntPtr hdc, DeviceCap nIndex);
public static extern int GetDeviceCaps(HandleRef hdc, DeviceCap capability);
public static extern int GetDeviceCaps( User32.SafeDCHandle hdc, DeviceCap nIndex);
public static extern int GetDeviceCaps(IntPtr hdc, DeviceCap deviceCap);
public static extern Int32 GetDeviceCaps(IntPtr hDC, DeviceCap cap);
public static extern int GetDeviceCaps(SafeDC hdc, DeviceCap nIndex);
public static extern int GetDeviceCaps(IntPtr hdc, DeviceCap nIndex);
internal static extern int GetDeviceCaps(IntPtr hDc, DeviceCap nIndex);
public static extern Int32 GetDeviceCaps(IntPtr hdc, DeviceCap capindex);
public static extern int GetDeviceCaps( HandleRef hdc, [MarshalAs(UnmanagedType.I4)] DeviceCap nIndex );
public static extern int GetDeviceCaps(HDC hdc, DeviceCap index);
internal static extern int GetDeviceCaps(IntPtr hDC, DeviceCap cap);