private void GetScreenOprator_Click(object sender, EventArgs e) { this.Hide(); GetScreen _GetScreen = new GetScreen(); _GetScreen.GetWholeScreen(this); }
/// <summary> /// 鼠标释放,最终运算 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pictureBox_MouseUp(object sender, MouseEventArgs e) { CheckForIllegalCrossThreadCalls = false; this.Hide(); _EndPoint.X = Cursor.Position.X; _EndPoint.Y = Cursor.Position.Y; //创建图象,保存将来截取的图象 Bitmap image = new Bitmap(Math.Abs(_StartPoint.X - _EndPoint.X), Math.Abs(_StartPoint.Y - _EndPoint.Y)); Graphics imgGraphics = Graphics.FromImage(image); //设置截屏区域 imgGraphics.CopyFromScreen(_StartPoint.X, _StartPoint.Y, 0, 0, new Size(Math.Abs(_StartPoint.X - _EndPoint.X), Math.Abs(_StartPoint.Y - _EndPoint.Y))); //保存; GetScreen GS = new GetScreen(); string Path = GS.SaveImage(image, true); OCR _ocr = (OCR)BeforeForm; _ocr.Show(); _ocr.MaximizeBox = true; _ocr.TopMost = true; _ocr.TranslateOCRByScreenImage(Path); }