private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { bool flag = e.ColumnIndex == this.dataGridView1.Columns[this.ColumnItemOCR.Name].Index; if (flag) { object value = this.dataGridView1.Rows[e.RowIndex].Cells[this.ColumnItemOCRType.Name].Value; bool flag2 = value == null; if (!flag2) { CnOCRType type = (CnOCRType)Enum.Parse(typeof(CnOCRType), value.ToString()); bool flag3 = this._curinfo != null && this._curinfo.LocalPath != null && FileHelper.IsImageExt(this._curinfo.LocalPath); if (flag3) { if (LibCommon.AppContext.GetInstance().GetVal <CmdDispatcher>(typeof(CmdDispatcher)).GetUCCenterView().Realview is UCPictureView) { UCPictureView pictureView = LibCommon.AppContext.GetInstance().GetVal <CmdDispatcher>(typeof(CmdDispatcher)).GetUCCenterView().Realview as UCPictureView; //pictureView.getImage(); Rectangle rec = pictureView.GetSelectedRectangle(); string text = OCRMgr.Parse(type, new Bitmap(pictureView.getImage()), rec); //string text = OCRMgr.Parse(type, ImageHelper.LoadCorectedImage(this._curinfo.LocalPath).ToBitmap(), rec); this.dataGridView1.Rows[e.RowIndex].Cells[this.ColumnItemValue.Name].Value = text; this._curinfo.ExFaPiaoCode = text; this._curinfo.OnDataChanged(); } } } } }
public static string Parse(CnOCRType type, Bitmap bitmap, Rectangle rc) { return(OCRMgr._parsers[type](bitmap, rc)); }