protected bool OnPaint(IntPtr hWnd) { var ps = new Win32.PAINTSTRUCT(); if (OffScreenGraphics == null) return false; var hdc = Win32.BeginPaint(hWnd, ref ps); var hdcMem = OffScreenGraphics.GetHdc(); try { using (Gdi g = Gdi.FromHdc(hdc, ps.rcPaint)) { using (Gdi gMem = Gdi.FromHdc(hdcMem, Rectangle.Empty)) { Rectangle rect = ps.rcPaint; try { DrawScreenOn(gMem, rect, _currentScrollPosition); } catch (COMException ex) { throw; } catch (Exception) { throw; } g.BitBlt(rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top, gMem, rect.Left, rect.Top, TernaryRasterOperations.SRCCOPY); } } } finally { OffScreenGraphics.ReleaseHdc(hdcMem); Win32.EndPaint(hWnd, ref ps); } return true; }
bool OnPaint(IntPtr hWnd) { if (CurrentTransition == null) return false; var ps = new Win32.PAINTSTRUCT(); IntPtr hdc = Win32.BeginPaint(hWnd, ref ps); IntPtr hdcMem = _offScreenGraphics.GetHdc(); using (Gdi g = Gdi.FromHdc(hdc, ps.rcPaint)) { using (Gdi gMem = Gdi.FromHdc(hdcMem, Rectangle.Empty)) { Rectangle rect = ps.rcPaint; try { CurrentTransition.DrawScreenOn(gMem, ps.rcPaint); } catch (Exception) { throw; } g.BitBlt(rect.Left, rect.Top, rect.Width, rect.Height, hdcMem, rect.Left, rect.Top, TernaryRasterOperations.SRCCOPY); } } _offScreenGraphics.ReleaseHdc(hdcMem); Win32.EndPaint(hWnd, ref ps); return true; }