public Bitmap(int width, int height, Graphics g) { ArgumentNullException.ThrowIfNull(g); IntPtr bitmap; int status = Gdip.GdipCreateBitmapFromGraphics(width, height, new HandleRef(g, g.NativeGraphics), out bitmap); Gdip.CheckStatus(status); SetNativeImage(bitmap); }
public Bitmap(int width, int height, Graphics g) { if (g == null) { throw new ArgumentNullException(nameof(g)); } IntPtr bitmap = IntPtr.Zero; int status = Gdip.GdipCreateBitmapFromGraphics(width, height, new HandleRef(g, g.NativeGraphics), out bitmap); Gdip.CheckStatus(status); SetNativeImage(bitmap); }