private void btnCheckCode_Click(object sender, EventArgs e) { string filePath = Path.Combine(Application.StartupPath, "passCodeAction.jpg"); Image image = Bitmap.FromFile(filePath); Bitmap bitmap = (Bitmap)image; try { string result = CheckCode.Read(bitmap); MessageUtil.ShowTips(result); //好像变化了,不可以了。 } catch (Exception ex) { MessageUtil.ShowError(ex.Message); } }
private void btnCheckCode_Click(object sender, EventArgs e) { string filePath = Path.Combine(Application.StartupPath, "DB\\GenerateCheckCode.png"); Image image = Bitmap.FromFile(filePath); Bitmap bitmap = (Bitmap)image; try { string result = CheckCode.Read(bitmap); MessageDxUtil.ShowTips(result); //好像变化了,不可以了。 } catch (Exception ex) { LogHelper.WriteLog(LogLevel.LOG_LEVEL_CRIT, ex, typeof(Form1)); MessageDxUtil.ShowError(ex.Message); } }
static void Main() { try { Stream resStream = null; string fullpath = SaveImage(ref resStream); CheckCode cc = new CheckCode(); fullpath = @"f:\_queryCph.jpg"; Bitmap bmp = new Bitmap(fullpath); string s = cc.Read(bmp); } catch (Exception ex) { } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmCode()); }