public BufferedPaintHandle(IWin32Window wnd, SafeDCHandle hdc, Rectangle targetRectangle, BufferedPaintAnimationParams?animationParams = null, BufferedPaintParams paintParams = null, BufferedPaintBufferFormat fmt = BufferedPaintBufferFormat.CompatibleBitmap) : base(IntPtr.Zero, true) { RECT rc = targetRectangle; var ap = animationParams ?? BufferedPaintAnimationParams.Empty; IntPtr hdcFrom, hdcTo; var hbp = BeginBufferedAnimation(new HandleRef(wnd, wnd.Handle), hdc, ref rc, fmt, paintParams, ref ap, out hdcFrom, out hdcTo); if (hbp == IntPtr.Zero) { throw new Win32Exception(); } if (hdcFrom != IntPtr.Zero) { SourceGraphics = Graphics.FromHdc(hdcFrom); } if (hdcTo != IntPtr.Zero) { Graphics = Graphics.FromHdc(hdcTo); } SetHandle(hbp); ani = true; }
public BufferedPaintHandle(SafeDCHandle hdc, Rectangle targetRectangle, BufferedPaintParams paintParams = null, BufferedPaintBufferFormat fmt = BufferedPaintBufferFormat.CompatibleBitmap) : base(IntPtr.Zero, true) { RECT target = targetRectangle; var hbp = BeginBufferedPaint(hdc, ref target, fmt, paintParams, out var phdc); if (hbp == IntPtr.Zero) { throw new Win32Exception(); } if (phdc != IntPtr.Zero) { Graphics = Graphics.FromHdc(phdc); } SetHandle(hbp); }
public static extern IntPtr BeginBufferedPaint(SafeDCHandle hdcTarget, [In] ref RECT prcTarget, BufferedPaintBufferFormat dwFormat, [In] BufferedPaintParams pPaintParams, out IntPtr phdc);
public static extern IntPtr BeginBufferedAnimation(HandleRef hwnd, SafeDCHandle hdcTarget, [In] ref RECT rcTarget, BufferedPaintBufferFormat dwFormat, [In] BufferedPaintParams pPaintParams, [In] ref BufferedPaintAnimationParams pAnimationParams, out IntPtr phdcFrom, out IntPtr phdcTo);