private BaseShape CheckHover() { if (!IsCursorOnNode && !IsCreating && !IsMoving && !IsResizing) { BaseShape shape = GetIntersectShape(); if (shape != null && shape.IsValidShape) { return(shape); } else { switch (CurrentTool) { case ShapeType.RegionFreehand: case ShapeType.DrawingFreehand: case ShapeType.DrawingLine: case ShapeType.DrawingArrow: case ShapeType.DrawingTextOutline: case ShapeType.DrawingTextBackground: case ShapeType.DrawingSpeechBalloon: case ShapeType.DrawingStep: case ShapeType.DrawingImage: case ShapeType.DrawingCursor: return(null); } if (Options.IsFixedSize && IsCurrentShapeTypeRegion) { Point location = InputManager.ClientMousePosition; return(new RectangleRegionShape() { Rectangle = new Rectangle(new Point(location.X - Options.FixedSize.Width / 2, location.Y - Options.FixedSize.Height / 2), Options.FixedSize) }); } else { SimpleWindowInfo window = FindSelectedWindow(); if (window != null && !window.Rectangle.IsEmpty) { Rectangle hoverArea = CaptureHelpers.ScreenToClient(window.Rectangle); return(new RectangleRegionShape() { Rectangle = Rectangle.Intersect(Form.ClientArea, hoverArea) }); } } } } return(null); }
private void CheckHover() { CurrentHoverShape = null; if (!IsCursorOnNode && !IsCreating && !IsMoving && !IsResizing) { BaseShape shape = GetIntersectShape(); if (shape != null && shape.IsValidShape) { CurrentHoverShape = shape; } else { switch (CurrentShapeType) { case ShapeType.RegionFreehand: case ShapeType.DrawingFreehand: case ShapeType.DrawingLine: case ShapeType.DrawingArrow: case ShapeType.DrawingTextOutline: case ShapeType.DrawingTextBackground: case ShapeType.DrawingSpeechBalloon: case ShapeType.DrawingStep: case ShapeType.DrawingImage: return; } if (Config.IsFixedSize && IsCurrentShapeTypeRegion) { Point location = InputManager.MousePosition0Based; CurrentHoverShape = new RectangleRegionShape() { Rectangle = new Rectangle(new Point(location.X - Config.FixedSize.Width / 2, location.Y - Config.FixedSize.Height / 2), Config.FixedSize) }; } else { SimpleWindowInfo window = FindSelectedWindow(); if (window != null && !window.Rectangle.IsEmpty) { Rectangle hoverArea = CaptureHelpers.ScreenToClient(window.Rectangle); CurrentHoverShape = new RectangleRegionShape() { Rectangle = Rectangle.Intersect(form.ScreenRectangle0Based, hoverArea) }; } } } } }
public WindowInfo FindSelectedWindowInfo(Point position) { if (Windows != null) { SimpleWindowInfo windowInfo = Windows.FirstOrDefault(x => x.IsWindow && x.Rectangle.Contains(position)); if (windowInfo != null) { return(windowInfo.WindowInfo); } } return(null); }
private void RectangleRegion_MouseDown(object sender, MouseEventArgs e) { if ((OneClickMode || ScreenColorPickerMode) && e.Button == MouseButtons.Left) { CurrentPosition = InputManager.MousePosition; if (OneClickMode) { SelectedWindow = AreaManager.FindSelectedWindow(); } Close(SurfaceResult.Region); } }
private void RectangleRegion_MouseDown(object sender, MouseEventArgs e) { if ((Mode == RectangleRegionMode.OneClick || Mode == RectangleRegionMode.ScreenColorPicker) && e.Button == MouseButtons.Left) { CurrentPosition = InputManager.MousePosition; if (Mode == RectangleRegionMode.OneClick) { SelectedWindow = ShapeManager.FindSelectedWindow(); } Close(RegionResult.Region); } }
private bool CheckHandle(IntPtr handle, bool isWindow) { if (handle == IgnoreHandle || !NativeMethods.IsWindowVisible(handle) || (isWindow && NativeMethods.IsWindowCloaked(handle))) { return(true); } SimpleWindowInfo windowInfo = new SimpleWindowInfo(handle); if (isWindow) { windowInfo.IsWindow = true; windowInfo.Rectangle = CaptureHelpers.GetWindowRectangle(handle); } else { windowInfo.Rectangle = NativeMethods.GetWindowRect(handle); } if (!windowInfo.Rectangle.IsValid()) { return(true); } if (IncludeChildWindows && !parentHandles.Contains(handle)) { parentHandles.Add(handle); EnumWindowsProc ewp = EvalControl; NativeMethods.EnumChildWindows(handle, ewp, IntPtr.Zero); } if (isWindow) { Rectangle clientRect = NativeMethods.GetClientRect(handle); if (clientRect.IsValid() && clientRect != windowInfo.Rectangle) { windows.Add(new SimpleWindowInfo(handle, clientRect)); } } windows.Add(windowInfo); return(true); }
private void CheckHover() { CurrentHoverRectangle = Rectangle.Empty; if (!ResizeManager.IsCursorOnNode() && !IsCreating && !IsMoving && !IsResizing) { BaseShape shape = GetShapeIntersect(); if (shape != null && !shape.Rectangle.IsEmpty) { CurrentHoverRectangle = shape.Rectangle; } else { switch (CurrentShapeType) { case ShapeType.DrawingLine: case ShapeType.DrawingArrow: case ShapeType.DrawingStep: return; } if (Config.IsFixedSize && IsCurrentShapeTypeRegion) { Point location = InputManager.MousePosition0Based; CurrentHoverRectangle = new Rectangle(new Point(location.X - Config.FixedSize.Width / 2, location.Y - Config.FixedSize.Height / 2), Config.FixedSize); } else { SimpleWindowInfo window = FindSelectedWindow(); if (window != null && !window.Rectangle.IsEmpty) { Rectangle hoverArea = CaptureHelpers.ScreenToClient(window.Rectangle); CurrentHoverRectangle = Rectangle.Intersect(form.ScreenRectangle0Based, hoverArea); } } } } }
private void SelectHandle() { WindowState = FormWindowState.Minimized; bool capturing = false; try { Thread.Sleep(250); SimpleWindowInfo simpleWindowInfo = RegionCaptureTasks.GetWindowInfo(RegionCaptureOptions); if (simpleWindowInfo != null) { selectedWindow = new WindowInfo(simpleWindowInfo.Handle); lblControlText.Text = selectedWindow.ClassName ?? ""; selectedRectangle = simpleWindowInfo.Rectangle; lblSelectedRectangle.Text = selectedRectangle.ToString(); btnSelectRectangle.Enabled = btnCapture.Enabled = true; if (Options.StartCaptureAutomatically) { capturing = true; StartCapture(); } } else { btnCapture.Enabled = false; } } finally { if (!capturing) { this.ForceActivate(); } } }
private void CheckHover() { CurrentHoverArea = Rectangle.Empty; if (!ResizeManager.IsCursorOnNode() && !IsCreating && !IsMoving && !IsResizing) { Rectangle hoverArea = GetAreaIntersectWithMouse(); if (!hoverArea.IsEmpty) { CurrentHoverArea = hoverArea; } else { SimpleWindowInfo window = FindSelectedWindow(); if (window != null && !window.Rectangle.IsEmpty) { hoverArea = CaptureHelpers.ScreenToClient(window.Rectangle); CurrentHoverArea = Rectangle.Intersect(surface.ScreenRectangle0Based, hoverArea); } } } }
private void RectangleRegion_MouseDown(object sender, MouseEventArgs e) { if ((OneClickMode || ScreenColorPickerMode) && e.Button == MouseButtons.Left) { CurrentPosition = InputManager.MousePosition; if (OneClickMode) { SelectedWindow = AreaManager.FindSelectedWindow(); } Close(SurfaceResult.Region); } }
private bool CheckHandle(IntPtr handle, bool isWindow) { if (handle == IgnoreHandle || !NativeMethods.IsWindowVisible(handle) || (isWindow && NativeMethods.IsWindowCloaked(handle))) { return true; } SimpleWindowInfo windowInfo = new SimpleWindowInfo(handle); if (isWindow) { windowInfo.IsWindow = true; windowInfo.Rectangle = CaptureHelpers.GetWindowRectangle(handle); } else { windowInfo.Rectangle = NativeMethods.GetWindowRect(handle); } if (!windowInfo.Rectangle.IsValid()) { return true; } if (IncludeChildWindows && !parentHandles.Contains(handle)) { parentHandles.Add(handle); EnumWindowsProc ewp = EvalControl; NativeMethods.EnumChildWindows(handle, ewp, IntPtr.Zero); } if (isWindow) { Rectangle clientRect = NativeMethods.GetClientRect(handle); if (clientRect.IsValid() && clientRect != windowInfo.Rectangle) { windows.Add(new SimpleWindowInfo(handle, clientRect)); } } windows.Add(windowInfo); return true; }
private void RectangleRegion_MouseDown(object sender, MouseEventArgs e) { if ((Mode == RectangleRegionMode.OneClick || Mode == RectangleRegionMode.ScreenColorPicker) && e.Button == MouseButtons.Left) { CurrentPosition = InputManager.MousePosition; if (Mode == RectangleRegionMode.OneClick) { SelectedWindow = ShapeManager.FindSelectedWindow(); } Close(RegionResult.Region); } }