public static DeviceContext FromCompatibleDC(IntPtr hdc) { return(new DeviceContext(IntUnsafeNativeMethods.CreateCompatibleDC(new HandleRef(null, hdc)), System.Windows.Forms.Internal.DeviceContextType.Memory)); }