Esempio n. 1
0
        void TryUpdateGraphics()
        {
            var winRect = Window.Rect;

            if (width != winRect.Width || height != winRect.Height)
            {
                width  = winRect.Width;
                height = winRect.Height;
                buffer = new int[width * height];
                if (hBitmap != IntPtr.Zero)
                {
                    WinApi.DeleteObject(hBitmap);
                }
                hBitmap = WinApi.CreateBitmap(width, height, 1, 32, IntPtr.Zero);
                if (hBitmap == IntPtr.Zero)
                {
                    throw new Exception();
                }
                WinApi.SelectObject(memDC, hBitmap);
            }
        }
Esempio n. 2
0
 protected override void Dispose(bool disposing)
 {
     WinApi.DeleteObject(hBitmap);
     WinApi.DeleteDC(memDC);
     WinApi.ReleaseDC(Window.Handle, hdc);
 }