private System.Drawing.Rectangle GetRecordingCoordinates() { if (!WindowLocator.GetWindowRect(CaptureWindowPtr, out WindowLocator.RECT rect)) { throw new Exception("Can't find capture window coordinates"); } //not to show recording frame border const int ignoredPixels = 3; return(new System.Drawing.Rectangle(rect.Left + ignoredPixels, rect.Top + ignoredPixels, rect.Right - rect.Left - ignoredPixels * 2, rect.Bottom - rect.Top - ignoredPixels * 2)); }
private void OnMouseAction(object sender, EventArgs e) { if (!_isWindowCapturer || !IsVisible || IsRecording || _isCountdown) { return; } if (!WindowLocator.GetCursorPos(out WindowLocator.POINT p)) { return; } IEnumerable <IntPtr> wisibleWindows = WindowLocator.FindWindows(); IntPtr foundWindow = WindowLocator.WindowFromPoint(p); IntPtr window = wisibleWindows.FirstOrDefault(w => w == foundWindow); if (window != null && window != CaptureWindowPtr) { WindowLocator.SetForegroundWindow(foundWindow); WindowLocator.GetWindowRect(foundWindow, out WindowLocator.RECT rect); WindowLocator.MoveWindow(CaptureWindowPtr, rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top, true); } }