private void timer_Tick(object sender, EventArgs e) { PreviousMousePosition = CurrentMousePosition; CurrentMousePosition = CaptureHelpers.GetCursorPosition(); SelectionRectangle = CaptureHelpers.CreateRectangle(positionOnClick.X, positionOnClick.Y, CurrentMousePosition.X, CurrentMousePosition.Y); Refresh(); }
public void ShowMenu() { ContextMenuStrip cms = new ContextMenuStrip { Font = new Font("Arial", 10f), AutoClose = false, ShowImageMargin = false }; if (Program.Settings != null && Program.Settings.QuickTaskPresets != null && Program.Settings.QuickTaskPresets.Count > 0) { foreach (QuickTaskInfo taskInfo in Program.Settings.QuickTaskPresets) { if (taskInfo.IsValid) { ToolStripMenuItem tsmi = new ToolStripMenuItem { Text = taskInfo.ToString().Replace("&", "&&"), Tag = taskInfo }; tsmi.Click += (sender, e) => { QuickTaskInfo selectedTaskInfo = ((ToolStripMenuItem)sender).Tag as QuickTaskInfo; cms.Close(); OnTaskInfoSelected(selectedTaskInfo); }; cms.Items.Add(tsmi); } else { cms.Items.Add(new ToolStripSeparator()); } } cms.Items[0].Select(); cms.Items.Add(new ToolStripSeparator()); } // Translate ToolStripMenuItem tsmiEdit = new ToolStripMenuItem("Edit this menu..."); tsmiEdit.Click += (sender, e) => { cms.Close(); new QuickTaskMenuEditorForm().ShowDialog(); }; cms.Items.Add(tsmiEdit); cms.Items.Add(new ToolStripSeparator()); ToolStripMenuItem tsmiCancel = new ToolStripMenuItem("Cancel"); tsmiCancel.Click += (sender, e) => cms.Close(); cms.Items.Add(tsmiCancel); Point cursorPosition = CaptureHelpers.GetCursorPosition(); cursorPosition.Offset(-10, -10); cms.Show(cursorPosition); }
private void RectangleAnnotate_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { positionOnClick = CaptureHelpers.GetCursorPosition(); isMouseDown = true; } }
private void timer_Tick(object sender, EventArgs e) { currentPosition = CaptureHelpers.GetCursorPosition(); PreviousSelectionRectangle = SelectionRectangle; SelectionRectangle = CaptureHelpers.CreateRectangle(positionOnClick.X, positionOnClick.Y, currentPosition.X, currentPosition.Y); UpdateBackgroundImage(); }
private void timer_Tick(object sender, EventArgs e) { currentPosition = CaptureHelpers.GetCursorPosition(); PreviousSelectionRectangle = SelectionRectangle; SelectionRectangle = CaptureHelpers.CreateRectangle(positionOnClick.X, positionOnClick.Y, currentPosition.X, currentPosition.Y); try { RefreshSurface(); } catch { } }
private void RectangleLight_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { positionOnClick = CaptureHelpers.GetCursorPosition(); isMouseDown = true; } else if (isMouseDown) { isMouseDown = false; Refresh(); } else { Close(); } }
private void timer_Tick(object sender, EventArgs e) { currentPosition = CaptureHelpers.GetCursorPosition(); PreviousSelectionRectangle = SelectionRectangle; SelectionRectangle = CaptureHelpers.CreateRectangle(positionOnClick.X, positionOnClick.Y, currentPosition.X, currentPosition.Y); try { RefreshSurface(); } catch (Exception ex) { #if DEBUG MessageBox.Show(ex.ToString()); #endif } }
private void colorTimer_Tick(object sender, EventArgs e) { Point position = CaptureHelpers.GetCursorPosition(); UpdateColor(position.X, position.Y); }
public void ShowMenu() { ContextMenuStrip cms = new ContextMenuStrip() { Font = new Font("Arial", 10f), AutoClose = false }; cms.KeyUp += (sender, e) => { if (e.KeyCode == Keys.Escape) { cms.Close(); } }; ToolStripMenuItem tsmiContinue = new ToolStripMenuItem(Resources.QuickTaskMenu_ShowMenu_Continue); tsmiContinue.Image = Resources.control; tsmiContinue.Click += (sender, e) => { cms.Close(); OnTaskInfoSelected(null); }; cms.Items.Add(tsmiContinue); cms.Items.Add(new ToolStripSeparator()); if (Program.Settings != null && Program.Settings.QuickTaskPresets != null && Program.Settings.QuickTaskPresets.Count > 0) { foreach (QuickTaskInfo taskInfo in Program.Settings.QuickTaskPresets) { if (taskInfo.IsValid) { ToolStripMenuItem tsmi = new ToolStripMenuItem { Text = taskInfo.ToString().Replace("&", "&&"), Tag = taskInfo }; tsmi.Image = FindSuitableIcon(taskInfo); tsmi.Click += (sender, e) => { QuickTaskInfo selectedTaskInfo = ((ToolStripMenuItem)sender).Tag as QuickTaskInfo; cms.Close(); OnTaskInfoSelected(selectedTaskInfo); }; cms.Items.Add(tsmi); } else { cms.Items.Add(new ToolStripSeparator()); } } cms.Items[0].Select(); cms.Items.Add(new ToolStripSeparator()); } ToolStripMenuItem tsmiEdit = new ToolStripMenuItem(Resources.QuickTaskMenu_ShowMenu_Edit_this_menu___); tsmiEdit.Image = Resources.pencil; tsmiEdit.Click += (sender, e) => { cms.Close(); new QuickTaskMenuEditorForm().ShowDialog(); }; cms.Items.Add(tsmiEdit); cms.Items.Add(new ToolStripSeparator()); ToolStripMenuItem tsmiCancel = new ToolStripMenuItem(Resources.QuickTaskMenu_ShowMenu_Cancel); tsmiCancel.Image = Resources.cross; tsmiCancel.Click += (sender, e) => cms.Close(); cms.Items.Add(tsmiCancel); if (ShareXResources.UseCustomTheme) { ShareXResources.ApplyCustomThemeToContextMenuStrip(cms); } Point cursorPosition = CaptureHelpers.GetCursorPosition(); cursorPosition.Offset(-10, -10); cms.Show(cursorPosition); cms.Focus(); }