public void CaptureWindow() { if (_hPreviousWindow == IntPtr.Zero) { return; } WindowHighlighter.Refresh(_hPreviousWindow); using (Bitmap bmpWnd = BitmapHandler.GenerateBitmapFromHWnd(_hPreviousWindow)) { Bitmap bmp = BitmapHandler.GenerateFullBitmapAroundCrop(bmpWnd, out origBmpRect); ActivateFormWithBitmap(bmp, true, CurrentState.STATE_EDITING, EditState.PEN); } }
public void HighlightCapturingWindows(Point pt) { // capture the window under the cursor's position IntPtr hWnd = Win32.WindowFromPoint(pt); // if the window we're over, is not the same as the one before, and we had one before, refresh it if (_hPreviousWindow != IntPtr.Zero && _hPreviousWindow != hWnd) { WindowHighlighter.Refresh(_hPreviousWindow); } if (hWnd != IntPtr.Zero) { // save the window we're over _hPreviousWindow = hWnd; Win32.Rect rc = new Win32.Rect(); Win32.GetWindowRect(hWnd, ref rc); // highlight the window WindowHighlighter.Highlight(hWnd); } }