コード例 #1
0
ファイル: BufferedPaint.cs プロジェクト: wushian/Vanara
        /// <summary>Initializes a new instance of the <see cref="BufferedPainter"/> class and begins a buffered paint operation.</summary>
        /// <param name="hdc">The handle of the target DC on which the buffer will be painted.</param>
        /// <param name="targetRectangle">Specifies the area of the target DC in which to paint.</param>
        /// <param name="paintParams">The paint operation parameters. This value can be <see langword="null"/>.</param>
        /// <param name="fmt">The format of the buffer.</param>
        /// <exception cref="Win32Exception">Buffered painting could not initialize.</exception>
        public BufferedPainter(HDC hdc, Rectangle targetRectangle, BP_PAINTPARAMS paintParams = null,
                               BP_BUFFERFORMAT fmt = BP_BUFFERFORMAT.BPBF_TOPDOWNDIB)
        {
            RECT target = targetRectangle;

            hbp = BeginBufferedPaint(hdc, target, fmt, paintParams, out var phdc);
            if (hbp.IsInvalid)
            {
                throw new Win32Exception();
            }
            if (!phdc.IsNull)
            {
                Graphics = Graphics.FromHdc((IntPtr)phdc);
            }
        }
コード例 #2
0
        /// <summary>Initializes a new instance of the <see cref="BufferedPainter"/> class and begins a buffered paint operation.</summary>
        /// <param name="hdc">The handle of the target DC on which the buffer will be painted.</param>
        /// <param name="targetRectangle">Specifies the area of the target DC in which to paint.</param>
        /// <param name="paintParams">The paint operation parameters. This value can be <see langword="null"/>.</param>
        /// <param name="fmt">The format of the buffer.</param>
        /// <exception cref="Win32Exception">Buffered painting could not initialize.</exception>
        public BufferedPainter(SafeDCHandle hdc, Rectangle targetRectangle, BP_PAINTPARAMS paintParams = null,
                               BP_BUFFERFORMAT fmt = BP_BUFFERFORMAT.BPBF_TOPDOWNDIB)
        {
            RECT target = targetRectangle;

            hbp = BeginBufferedPaint(hdc, ref target, fmt, paintParams, out IntPtr phdc);
            if (hbp.IsInvalid)
            {
                throw new Win32Exception();
            }
            if (phdc != IntPtr.Zero)
            {
                Graphics = Graphics.FromHdc(phdc);
            }
        }
コード例 #3
0
 public static extern HRESULT GetBufferedPaintTargetRect(SafeBufferedPaintHandle hBufferedPaint, out RECT prc);
コード例 #4
0
 public static extern IntPtr GetBufferedPaintTargetDC(SafeBufferedPaintHandle hBufferedPaint);
コード例 #5
0
 public static extern HRESULT GetBufferedPaintBits(SafeBufferedPaintHandle hBufferedPaint, out IntPtr ppbBuffer, out int pcxRow);
コード例 #6
0
 public static extern HRESULT BufferedPaintSetAlpha(SafeBufferedPaintHandle hBufferedPaint, ref RECT prc, byte alpha);
コード例 #7
0
 public static extern HRESULT BufferedPaintClear(SafeBufferedPaintHandle hBufferedPaint, ref RECT prc);