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 FormImgFullScreen(UCPictureView parent) { this.InitializeComponent(); this._parent = parent; this.ShowParentPic(); this.ImageScreen.MouseDoubleClick += new MouseEventHandler(this.ImageScreen_MouseDoubleClick); }
static ExtAssociation() { //ExtAssociation._ext2UC = new Dictionary<string, IUCView>(); //TODO 改目录,最后都输出到一起 string[] files = Directory.GetFiles(".", "DocScanner.View.dll"); if (files.Length == 0) { //TODO } else { string assemblyFile = files[0]; try { Assembly assembly = Assembly.LoadFrom(assemblyFile); Type[] exportedTypes = assembly.GetExportedTypes(); //TODO 名字定义好 List <Type> types = exportedTypes.Where <Type>(x => x.Name.EndsWith("View")).ToList(); //string fullName = exportedTypes.First(new Func<Type, bool>(o => o.Name.EndsWith("View"))).FullName; foreach (Type type in types) { IUCView iUCView = assembly.CreateInstance(type.FullName) as IUCView; bool flag = iUCView != null; if (flag) { string[] supportTypeExt = iUCView.GetSupportTypeExt(); string[] array2 = supportTypeExt; for (int j = 0; j < array2.Length; j++) { string key = array2[j]; //ExtAssociation._ext2UC[key] = iUCView; _ext2UC.Add(key, iUCView); } } } } catch (Exception ex) { LibCommon.AppContext.GetInstance().MS.LogError(ex.ToString()); } } UCPictureView uCPictureView = new UCPictureView(); string[] supportTypeExt2 = uCPictureView.GetSupportTypeExt(); for (int k = 0; k < supportTypeExt2.Length; k++) { string key2 = supportTypeExt2[k]; //ExtAssociation._ext2UC[key2] = uCPictureView; _ext2UC.Add(key2, uCPictureView); } }