-
Notifications
You must be signed in to change notification settings - Fork 0
/
frm_Ocr.cs
68 lines (58 loc) · 1.63 KB
/
frm_Ocr.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using Tesseract;
namespace AutoOffice
{
public partial class frm_Ocr : Form
{
OcrUtil oOcr;
public frm_Ocr()
{
InitializeComponent();
}
private void btn_open_Click(object sender, EventArgs e)
{
var ok = this.ofd.ShowDialog();
if (ok == DialogResult.OK)
{
oOcr.ImagePath = this.ofd.FileName;
this.picb.Image = Image.FromFile(oOcr.ImagePath);
}
}
private void frm_Ocr_Load(object sender, EventArgs e)
{
foreach(var item in OcrUtil.Langs)
{
this.cbo_langs.Items.Add(item);
}
if (OcrUtil.Langs.Length > 0)
{
this.cbo_langs.SelectedIndex = 0;
}
oOcr = new OcrUtil();
oOcr.DoneEvent += OnDoneEvent;
}
private void OnDoneEvent(object sender, DoneArgs e)
{
this.Cursor = Cursors.Default;
}
private void btn_run_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.cbo_langs.Text) == true)
{
MessageBox.Show("언어를 선택하세요");
return;
}
this.Cursor = Cursors.WaitCursor;
this.txt_out.Text = oOcr.ReadText(this.cbo_langs.Text);
}
}
}