Exemplo n.º 1
0
        public void ClearCaptureEnvironment()
        {
            IsCaptureEnable = false;

            GdiApi.DeleteObject(MemoryBitmapHandle);

            GdiApi.DeleteDC(_memoryDC);

            GdiApi.ReleaseDC(Handle, _windowDC);
            GdiApi.DeleteDC(_windowDC);
        }
Exemplo n.º 2
0
        public void CreateEnvironment()
        {
            Trace.Assert(_windowDC == IntPtr.Zero);
            Trace.Assert(_memoryDC == IntPtr.Zero);
            Trace.Assert(MemoryBitmapHandle == IntPtr.Zero);

            _windowDC = WindowApi.GetWindowDC(Handle);
            _memoryDC = GdiApi.CreateCompatibleDC(_windowDC);

            var rect = GetWindowRectangle();

            MemoryBitmapHandle = GdiApi.CreateCompatibleBitmap(_windowDC, rect.Width,
                                                               rect.Height);

            GdiApi.SelectObject(_memoryDC, MemoryBitmapHandle);

            IsCaptureEnable = true;
        }