private void test_sceen_Click(object sender, EventArgs e) { Bitmap bmp = ScreenHelpers.CaptureWindow(pWndTab); bmp.Save("测试截图.bmp"); MessageBox.Show("测试截图文件已被保存"); }
private String ocrText(IntPtr pWndIE, Rectangle rect) { try { Bitmap bmp = ScreenHelpers.CaptureWindow(pWndIE, rect); using (var page = engine.Process(bmp, PageSegMode.SingleLine)) { var text = page.GetText(); if (text != "") { return(text.Replace(" ", "")); } else { return("unrecorded"); } } } catch (Exception) { return("unrecorded"); } }