티스토리 뷰

프로그래밍/C#

c# QR코드 발생기 소스코드

뽀로로친구에디 2019. 3. 4. 22:18

c# QR코드 발생기 리더기 소스코드 




using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using ZXing;

using ZXing.Common;

using ZXing.QrCode.Internal;

using ZXing.Rendering;


namespace qrcode

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }


        private void button1_Click(object sender, EventArgs e)

        {

            BarcodeWriter barcodeWriter = new BarcodeWriter();

            EncodingOptions encodingOptions = new EncodingOptions() { Width = 300, Height = 300, Margin = 0, PureBarcode = false };

            encodingOptions.Hints.Add(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);

            barcodeWriter.Renderer = new BitmapRenderer();

            barcodeWriter.Options = encodingOptions;

            barcodeWriter.Format = BarcodeFormat.QR_CODE;

            Bitmap bitmap = barcodeWriter.Write(txtInput.Text);

            // Bitmap logo = new Bitmap($"{Application.StartupPath}/")

            Graphics g = Graphics.FromImage(bitmap);

            pictureBox1.Image = bitmap;

              


        }


        private void button2_Click(object sender, EventArgs e)

        {

            BarcodeReader barcodeReader = new BarcodeReader();

            var result = barcodeReader.Decode(new Bitmap(pictureBox1.Image));

            if (result != null)

                txtOutput.Text = result.Text;

        }

    }

}



댓글
최근에 달린 댓글
글 보관함
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Total
Today
Yesterday
    뽀로로친구에디
    최근에 올라온 글