基本信息
源码名称:C#开发的生成,识别 一维码、二维码的实例小程序 附源码
源码大小:2.32M
文件格式:.rar
开发语言:C#
更新时间:2018-10-22
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

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

本次赞助数额为: 2 元 
   源码介绍
C#开发的生成,识别 一维码、二维码的实例小程序    应用zxing    

 private void button1_Click(object sender, EventArgs e)
        {
            //设置条形码规格
            EncodingOptions encodeOption = new EncodingOptions();
            //设置宽和高
            encodeOption.Height = 130;
            encodeOption.Width = 240;
            BarcodeWriter wr = new BarcodeWriter();
            wr.Options = encodeOption;
            //条形码:根据自己的需要选择条形码格式
            wr.Format = BarcodeFormat.EAN_13;
            //生成条形码
            Bitmap image = wr.Write(textBox1.Text);
            //显示
            pictureBox1.Image = image;
        }

        //生成条形码-保存
        private void button6_Click(object sender, EventArgs e)
        {
            //保存图片
            saveImage(pictureBox1, textBox1.Text);
        }

        //读取条形码-选择图片
        private void button2_Click(object sender, EventArgs e)
        {
            //打开图片
            openImage(textBox2, pictureBox2);
        }

        //读取条形码-读取
        private void button8_Click(object sender, EventArgs e)
        {
            DecodingOptions decodeOption = new DecodingOptions();
            decodeOption.PossibleFormats = new List<BarcodeFormat>() { BarcodeFormat.EAN_13 };
            //读取条形码
            BarcodeReader br = new BarcodeReader();
            br.Options = decodeOption;
            Result result = br.Decode(pictureBox2.Image as Bitmap);
            if (result == null)
            {
                MessageBox.Show("读取失败");
            }
            else
            {
                //读取成功
                string xs = "";
                textBox3.Text = result.Text;
                xs = textBox3.Text;
                MessageBox.Show("一维码:" xs "","读取成功",MessageBoxButtons.OK,MessageBoxIcon.Asterisk);
            }
        }