CSharpGL.DIBSection.Resize C# (CSharp) Method

Resize() public method

Resizes the section.
public Resize ( int width, int height, int bitCount ) : void
width int The width.
height int The height.
bitCount int The bit count.
return void
        public void Resize(int width, int height, int bitCount)
        {
            //	Destroy existing objects.
            this.DestroyBitmap();

            //  Set parameters.
            this.Width = width;
            this.Height = height;

            //	Create a bitmap info structure.
            var info = new BitmapInfo();
            info.Init();

            //	Set the data.
            info.biBitCount = (short)bitCount;
            info.biPlanes = 1;
            info.biWidth = width;
            info.biHeight = height;

            //	Create the bitmap.
            IntPtr mdc = this.MemoryDeviceContext;
            this.HBitmap = Win32.CreateDIBSection(mdc, ref info, Win32.DIB_RGB_COLORS, out this.bits, IntPtr.Zero, 0);

            Win32.SelectObject(mdc, this.HBitmap);
        }