private static IntPtr CreateNewHDC(IntPtr outputHdc, Rectangle bounds, out IntPtr DIB) { IntPtr compatHdc = Native.GDI.CreateCompatibleDC(outputHdc); //Create a DIB-Bitmap on which to draw (DIB use top-down ref system, thus we set negative height) Native.Bitmap.BITMAPINFO info = new Native.Bitmap.BITMAPINFO(); info.biSize = Marshal.SizeOf(info); info.biWidth = bounds.Width; info.biHeight = -bounds.Height; info.biPlanes = 1; info.biBitCount = 32; info.biCompression = 0; DIB = Native.Bitmap.CreateDIBSection(outputHdc, ref info, 0, 0, IntPtr.Zero, 0); Native.GDI.SelectObject(compatHdc, DIB); return(compatHdc); }
private static IntPtr CreateNewHDC(IntPtr outputHdc, Rectangle bounds, out IntPtr DIB) { IntPtr compatHdc = Native.GDI.CreateCompatibleDC(outputHdc); //Create a DIB-Bitmap on which to draw (DIB use top-down ref system, thus we set negative height) Native.Bitmap.BITMAPINFO info = new Native.Bitmap.BITMAPINFO(); info.biSize = Marshal.SizeOf(info); info.biWidth = bounds.Width; info.biHeight = -bounds.Height; info.biPlanes = 1; info.biBitCount = 32; info.biCompression = 0; DIB = Native.Bitmap.CreateDIBSection(outputHdc, ref info, 0, 0, IntPtr.Zero, 0); Native.GDI.SelectObject(compatHdc, DIB); return compatHdc; }