示例#1
0
        public IBitmapFrame Capture()
        {
            Gdi32.BitBlt(_hdcDest, 0, 0, _region.Width, _region.Height,
                         _hdcSrc, _region.X, _region.Y,
                         (int)CopyPixelOperation.SourceCopy);

            var img = new OneTimeFrame(Image.FromHbitmap(_hBitmap));

            if (_includeCursor)
            {
                using (var editor = img.GetEditor())
                    MouseCursor.Draw(editor.Graphics, _transform);
            }

            return(img);
        }
示例#2
0
        public IBitmapFrame Capture()
        {
            try
            {
                OnCapture();

                var img = new OneTimeFrame(Image.FromHbitmap(_hBitmap));

                if (_includeCursor)
                {
                    using (var editor = img.GetEditor())
                        MouseCursor.Draw(editor.Graphics, _transform);
                }

                return(img);
            }
            catch (Exception e) when(!(e is WindowClosedException))
            {
                return(RepeatFrame.Instance);
            }
        }