SwapBuffers() private method

private SwapBuffers ( IntPtr hDC ) : int
hDC IntPtr
return int
        ///// <summary>
        ///// Sets the dimensions of the render context provider.
        ///// </summary>
        ///// <param name="width">Width.</param>
        ///// <param name="height">Height.</param>
        //public override void SetDimensions(int width, int height)
        //{
        //    //  Call the base.
        //    base.SetDimensions(width, height);

        //    //	Set the window size.
        //    Win32.SetWindowPos(windowHandle, IntPtr.Zero, 0, 0, Width, Height,
        //        SetWindowPosFlags.SWP_NOACTIVATE |
        //        SetWindowPosFlags.SWP_NOCOPYBITS |
        //        SetWindowPosFlags.SWP_NOMOVE |
        //        SetWindowPosFlags.SWP_NOOWNERZORDER);
        //}

        /// <summary>
        /// Blit the rendered data to the supplied device context.
        /// </summary>
        /// <param name="hdc">The HDC.</param>
        public override void Blit(IntPtr hdc)
        {
            if (this.DeviceContextHandle != IntPtr.Zero || windowHandle != IntPtr.Zero)
            {
                //	Swap the buffers.
                Win32.SwapBuffers(this.DeviceContextHandle);

                //  Get the HDC for the graphics object.
                Win32.BitBlt(hdc, 0, 0, this.Width, this.Height, this.DeviceContextHandle, 0, 0, Win32.SRCCOPY);
            }
        }
示例#2
0
        ///// <summary>
        ///// Sets the dimensions of the render context provider.
        ///// </summary>
        ///// <param name="width">Width.</param>
        ///// <param name="height">Height.</param>
        //public override void SetDimensions(int width, int height)
        //{
        //    //  Call the base.
        //    base.SetDimensions(width, height);

        //    //	Set the window size.
        //    Win32.SetWindowPos(windowHandle, IntPtr.Zero, 0, 0, Width, Height,
        //        SetWindowPosFlags.SWP_NOACTIVATE |
        //        SetWindowPosFlags.SWP_NOCOPYBITS |
        //        SetWindowPosFlags.SWP_NOMOVE |
        //        SetWindowPosFlags.SWP_NOOWNERZORDER);
        //}

        /// <summary>
        /// Blit the rendered data to the supplied device context.
        /// </summary>
        /// <param name="deviceContext">The HDC.</param>
        public override void Blit(IntPtr deviceContext)
        {
            IntPtr dc = this.DeviceContextHandle;

            if (dc != IntPtr.Zero || windowHandle != IntPtr.Zero)
            {
                //	Swap the buffers.
                Win32.SwapBuffers(dc);

                //	Blit the DC (containing the DIB section) to the target DC.
                Win32.BitBlt(deviceContext, 0, 0, this.Width, this.Height, dc, 0, 0, Win32.SRCCOPY);
            }
        }