public static Graphics FromHdc(IntPtr hdc) { if (hdc != IntPtr.Zero) { throw new NotImplementedException(); } int xSize, ySize; PixelFormat pixelFormat; IntPtr native = LibIGraph.GetScreen(out xSize, out ySize, out pixelFormat); if (native == IntPtr.Zero) { throw new Exception("CreateScreen() failed"); } return(new Graphics(xSize, ySize, pixelFormat, native)); }