ScreenToGif.Windows.Recorder.Cursor_Elapsed C# (CSharp) Method

Cursor_Elapsed() private method

private Cursor_Elapsed ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void Cursor_Elapsed(object sender, EventArgs e)
        {
            //Get the actual position of the form.
            var lefttop = Dispatcher.Invoke(() => new Point((int)((Left + Constants.LeftOffset) * _scale), (int)((Top + Constants.TopOffset) * _scale)));

            #region 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.

            #endregion

            var bt = Native.Capture(_size, lefttop.X, lefttop.Y);
            
            if (bt == null) return;

            string fileName = $"{_pathTemp}{FrameCount}.bmp";

            ListFrames.Add(new FrameInfo(fileName, FrameRate.GetMilliseconds(_snapDelay),
                new CursorInfo(CaptureCursor.CaptureImageCursor(ref _posCursor), OutterGrid.PointFromScreen(_posCursor), _recordClicked || Mouse.LeftButton == MouseButtonState.Pressed, _scale)));

            ThreadPool.QueueUserWorkItem(delegate { AddFrames(fileName, new Bitmap(bt)); });

            FrameCount++;
        }