Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- // **** PACKAGE MANAGAER CONSOLE
- // **** Install-Package ZXing.Net
- namespace BarCodes
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- radioButtonQR.Checked = true;
- radioButtonBC.Checked = false;
- }
- private void buttonConvert_Click(object sender, EventArgs e)
- {
- if (textBox.Text.Length == 0)
- {
- pictureBoxQR.Image = null;
- return;
- }
- var options = new QrCodeEncodingOptions
- {
- DisableECI = true,
- CharacterSet = "UTF-8",
- Width = 500,
- Height = 500,
- };
- var qr = new ZXing.BarcodeWriter();
- qr.Options = options;
- if(radioButtonQR.Checked)
- qr.Format = BarcodeFormat.QR_CODE;
- else
- qr.Format = BarcodeFormat.CODE_128;
- var result = new Bitmap(qr.Write(textBox.Text.Trim()));
- //"result" can also be used when printing QR Codes.
- //R:\Computer Science\Y13\Printing
- pictureBoxQR.Image = result;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement