CreateMemoryHdc() public static method

Create a compatible memory HDC from the given HDC.
The memory HDC can be rendered into without effecting the original HDC.
The returned memory HDC and dib must be released using ReleaseMemoryHdc.
public static CreateMemoryHdc ( IntPtr hdc, int width, int height, IntPtr &dib, IntPtr &ppvBits ) : IntPtr
hdc System.IntPtr the HDC to create memory HDC from
width int the width of the memory HDC to create
height int the height of the memory HDC to create
dib System.IntPtr returns used bitmap memory section that must be released when done with memory HDC
ppvBits System.IntPtr
return System.IntPtr
        public NativeWin32MemoryDc(int w, int h, bool invertImage = false)
        {
            this._width  = w;
            this._height = h;

            memHdc = MyWin32.CreateMemoryHdc(
                IntPtr.Zero,
                w,
                invertImage ? -h : h, //***
                out dib,
                out ppvBits);
        }
Esempio n. 2
0
        public NativeWin32MemoryDC(int w, int h, bool invertImage = false)
        {
            _width  = w;
            _height = h;

            _invertedImage = invertImage;

            _memHdc = MyWin32.CreateMemoryHdc(
                IntPtr.Zero,
                w,
                invertImage ? -h : h, //***
                out _dib,
                out _ppvBits);
        }