/// <summary> /// Triggers th element clicked event. /// </summary> /// <param name="element"> The element that was clicked. </param> /// <param name="point"> The point that was clicked. </param> protected virtual void OnElementClicked(Element element, Point point) { if (element.ProcessId != Process.Id) { return; } ElementClicked?.Invoke(element, point); }
private void ProcessMouseEvent(MouseEventArgs e) { int x = _bitmapCanvas.ToBitmapImageX(e.GetPosition(_bitmapCanvas).X); int y = _bitmapCanvas.ToBitmapImageY(e.GetPosition(_bitmapCanvas).Y); byte r = _selectedBrush.Color.R; byte g = _selectedBrush.Color.G; byte b = _selectedBrush.Color.B; ElementClicked?.Invoke(this, new ElementClickedEventArgs(x, y, r, g, b)); }
private void MouseWatcher_OnMouseInput(object sender, MouseEventArgs e) { if (e.Message == EventHook.Hooks.MouseMessages.WM_LBUTTONDOWN) { System.Diagnostics.Debug.WriteLine("MouseWatcher l-down"); var hoveredElement = GetHoveredElement(e.Point); if (hoveredElement != null) { ElementClicked?.Invoke(this, hoveredElement); } } else if (e.Message == EventHook.Hooks.MouseMessages.WM_RBUTTONDOWN) { var hoveredElement = GetHoveredElement(e.Point); if (hoveredElement != null) { ElementRightClicked?.Invoke(this, hoveredElement); } } }