public static void MakeScreenForm(ScreenType screenType, Action callback = null) { if (screenForm.instance == null) { screenForm form = new screenForm(screenType); form.Show(); form.callback = callback; } }
public screenForm() { instance = this; InitializeComponent(); this.MouseDown += new MouseEventHandler(mouse_Click); this.MouseMove += new MouseEventHandler(mouse_Move); this.Location = SystemInformation.VirtualScreen.Location; this.Size = SystemInformation.VirtualScreen.Size; g = this.CreateGraphics(); }
private void mouse_Up(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { RectangleDrawn = true; LeftButtonDown = false; Point curPos = new Point(Cursor.Position.X, Cursor.Position.Y); if (ClickPoint.X > curPos.X) { int temp = ClickPoint.X; ClickPoint.X = curPos.X; curPos.X = temp; } if (ClickPoint.Y > curPos.Y) { int temp = ClickPoint.Y; ClickPoint.Y = curPos.Y; curPos.Y = temp; } if (curPos.X == ClickPoint.X) { curPos.X++; } if (curPos.Y == ClickPoint.Y) { curPos.Y++; } if (screenType == ScreenType.Normal || screenType == ScreenType.Exception) { MakeAreaForm(screenType, ClickPoint.X, ClickPoint.Y, curPos.X - ClickPoint.X, curPos.Y - ClickPoint.Y, true); } else if (screenType == ScreenType.Quick) { MakeQuickOcrAreaForm(ClickPoint.X, ClickPoint.Y, curPos.X - ClickPoint.X, curPos.Y - ClickPoint.Y, FormManager.Instace.GetIsShowOcrAreaFlag()); } else if (screenType == ScreenType.Snap) { MakeSnapOcrAreaForm(ClickPoint.X, ClickPoint.Y, curPos.X - ClickPoint.X, curPos.Y - ClickPoint.Y); } } if (callback != null) { callback(); } callback = null; screenForm.instance = null; this.Close(); }