public int CompareTo(HotKeyCombo other) { if (key != other.key) { return(key.CompareTo(other.key)); } return(modifier.CompareTo(other.modifier)); }
private void CutOverlay_MouseDown(object sender, MouseEventArgs e) { if (_isFirstClick) { _doubleRec = new Rectangle(e.X - SystemInformation.DoubleClickSize.Width / 2, e.Y - SystemInformation.DoubleClickSize.Height / 2, SystemInformation.DoubleClickSize.Width, SystemInformation.DoubleClickSize.Height); _isFirstClick = false; _doubleClickTimer.Start(); } else { if (_doubleRec.Contains(e.Location)) { _isDoubleClick = true; } } if (e.Button == MouseButtons.Left && (ModifierKeys.CompareTo(Keys.Control) == 0 || !selection.Contains(e.Location))) { for (int i = 0; i < mouse_regions.Length; i++) { if (mouse_regions[i].Contains(e.Location)) { selection_region_clicked = i; selection_resizing = true; i = mouse_regions.Length; } } if (!selection_resizing) { selection_creating = true; creating_origin = new Point(e.Location.X, e.Location.Y); if (creating_origin.X < 0) { creating_origin.X = 0; } if (creating_origin.X > screen_on_focus.Bounds.Width) { creating_origin.X = screen_on_focus.Bounds.Width; } if (creating_origin.Y < 0) { creating_origin.Y = 0; } if (creating_origin.Y > screen_on_focus.Bounds.Height) { creating_origin.Y = screen_on_focus.Bounds.Height; } selection.Location = creating_origin; selection.Size = new Size(REGION_SIZE * 2, REGION_SIZE * 2); SetMouseRegions(); UpdateOverlay(); } } else if (e.Button == MouseButtons.Left && ModifierKeys.CompareTo(Keys.Control) != 0 && selection.Contains(e.Location)) { moving_offset = new Point(e.Location.X - selection.X, e.Location.Y - selection.Y); selection_moving = true; } else if (e.Button == MouseButtons.Middle) { CutSelection(); } }