基本信息
源码名称:ORC 文字识别(本实例支持 )
源码大小:0.74M
文件格式:.rar
开发语言:C#
更新时间:2017-02-07
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍

using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace CTOCR
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }

        private abstract class NativeMethod
        {
            [DllImport("AspriseOCR.dll", EntryPoint = "OCR", CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr OCR(string file, int type);

            [DllImport("AspriseOCR.dll", EntryPoint = "OCRpart", CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr OCRpart(string file, int type, int startX, int startY, int width, int height);

            [DllImport("AspriseOCR.dll", EntryPoint = "OCRBarCodes", CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr OCRBarCodes(string file, int type);

            [DllImport("AspriseOCR.dll", EntryPoint = "OCRpartBarCodes", CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr OCRpartBarCodes(string file, int type, int startX, int startY, int width, int height);

            public static readonly IntPtr NULL = IntPtr.Zero;
        }

        private void btnOcrFile_Click(object sender, EventArgs e)
        {
            if (ofdlgOcr.ShowDialog() == DialogResult.OK)
            {
                IntPtr pstrOcrValue = NativeMethod.OCR(txtFileName
                    .Text = ofdlgOcr.FileName, 0);
                txtOcrValue.Text = (pstrOcrValue == NativeMethod.NULL) ? 
                    string.Empty : Marshal.PtrToStringAnsi(pstrOcrValue);
            }
        }
    }
}