private void Cursor_Elapsed(object sender, EventArgs e) { //Get the actual position of the form. var lefttop = Dispatcher.Invoke(() => new Point((int)((Left + 9) * _dpi), (int)((Top + 34) * _dpi))); //TODO: 2 monitors. //They share the same resolution count. Position matters. //They have different DPI. //CopyFromScreen ignores DPI. So I need to adjust the position, multiplying by the DPI scalling factor: 125%, 150%. //_size matters too. //_gr.CopyFromScreen(lefttop.X, lefttop.Y, 0, 0, _size, CopyPixelOperation.CaptureBlt | CopyPixelOperation.SourceCopy); _bt = Native.Capture(_size, lefttop.X, lefttop.Y); string fileName = String.Format("{0}{1}.bmp", _pathTemp, _frameCount); ListFrames.Add(new FrameInfo(fileName, FrameRate.GetMilliseconds(_snapDelay), new CursorInfo(CaptureCursor.CaptureImageCursor(ref _posCursor), OutterGrid.PointFromScreen(_posCursor), _recordClicked, _dpi))); ThreadPool.QueueUserWorkItem(delegate { AddFrames(fileName, new Bitmap(_bt)); }); Dispatcher.Invoke(() => Title = String.Format("Screen To Gif • {0}", _frameCount)); _frameCount++; }
private void Full_Elapsed(object sender, EventArgs e) { var bt = Native.Capture(new System.Drawing.Size((int)_sizeScreen.X, (int)_sizeScreen.Y), 0, 0); string fileName = String.Format("{0}{1}.bmp", _pathTemp, _frameCount); ListFrames.Add(new FrameInfo(fileName, FrameRate.GetMilliseconds(_snapDelay))); ThreadPool.QueueUserWorkItem(delegate { AddFrames(fileName, new Bitmap(bt)); }); Dispatcher.Invoke(() => Title = String.Format("Screen To Gif • {0}", _frameCount)); _frameCount++; }
private void FullCursor_Elapsed(object sender, EventArgs e) { //_gr.CopyFromScreen(0, 0, 0, 0, new System.Drawing.Size((int)_sizeScreen.X, (int)_sizeScreen.Y), CopyPixelOperation.CaptureBlt | CopyPixelOperation.SourceCopy); _bt = Native.Capture(new System.Drawing.Size((int)_sizeScreen.X, (int)_sizeScreen.Y), 0, 0); string fileName = String.Format("{0}{1}.bmp", _pathTemp, _frameCount); ListFrames.Add(new FrameInfo(fileName, FrameRate.GetMilliseconds(_snapDelay), new CursorInfo(CaptureCursor.CaptureImageCursor(ref _posCursor), OutterGrid.PointFromScreen(_posCursor), _recordClicked, _dpi))); ThreadPool.QueueUserWorkItem(delegate { AddFrames(fileName, new Bitmap(_bt)); }); Dispatcher.Invoke(() => Title = String.Format("Screen To Gif • {0}", _frameCount)); _frameCount++; }
private void Normal_Elapsed(object sender, EventArgs e) { //Get the actual position of the form. var lefttop = Dispatcher.Invoke(() => new Point((int)((Left + 9) * _dpi), (int)((Top + 34) * _dpi))); //Take a screenshot of the area. var bt = Native.Capture(_size, lefttop.X, lefttop.Y); string fileName = String.Format("{0}{1}.bmp", _pathTemp, _frameCount); ListFrames.Add(new FrameInfo(fileName, FrameRate.GetMilliseconds(_snapDelay))); ThreadPool.QueueUserWorkItem(delegate { AddFrames(fileName, new Bitmap(bt)); }); Dispatcher.Invoke(() => Title = String.Format("Screen To Gif • {0}", _frameCount)); _frameCount++; }