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(); } } } } }
private void btnOCR_Click(object sender, EventArgs e) { bool flag = this.SelectOCRLan == OCRMgr.Lang.barcode; if (flag) { this.txtMsg.Text = ""; this.txtMsg.Text = OCRMgr.Bar_Parse(this.CutImg.ToBitmap()); } else { Rectangle rc = default(Rectangle); rc.X = 0; rc.Y = 0; rc.Width = this.CutImg.Width; rc.Height = this.CutImg.Height; string text = OCRMgr.TSORC_Parse(this.CutImg.ToBitmap(), this.SelectOCRLan, rc); bool flag2 = text != null; if (flag2) { this.txtMsg.Text = text; } } }