当前位置:网站首页>WinForm uses zxing to generate QR code
WinForm uses zxing to generate QR code
2022-06-29 10:31:00 【zlbcdn】
Only bar codes have been used before , Using a font library . I saw a QR code generator on the Internet this morning , Tried it , It's simple .
ZXing It's a pass Java Implementation of the open source class library , The main purpose is to generate / Analyze various bar codes , The supported encoding methods are as follows :

It supports many coding methods .
in addition , I found it on the Internet ZXing Of Demo Mostly Java Compiling , So you can also write it down winform With the implementation of the .
1、 effect


2、 Specific operation
3、 The code analysis
private void button1_Click(object sender, EventArgs e)
{
try
{
// Generate the core class of barcode , For specific related methods, please refer to the method description
var writer = new BarcodeWriter
{
Format = BarcodeFormat.QR_CODE,// The encoding type ( Enumeration type )
Options = new ZXing.Common.EncodingOptions
{
// Set the size of the barcode
Width=210,
Height=210
},
//BitMatrix
Renderer = (ZXing.Rendering.IBarcodeRenderer<Bitmap>)Activator.CreateInstance(Renderer)
};
// Generate content QR code , And show it in pictureBox On
// As for whether to save it locally or use it directly , It depends on the actual demand
this.pictureBox1.Image = writer.Write(this.textBox1.Text);
}
catch (Exception exc)
{
MessageBox.Show(this, exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}4、 Source download
边栏推荐
猜你喜欢
随机推荐
BUUCTF--内涵的软件
L1-009 sum of N numbers (20 points)
Analyze in detail the PBOT mining virus family behavior and the principle of exploited vulnerabilities, and provide detailed protection suggestions for the blue army
MySQL innodb每行数据长度的限制
September 23, 2020 left and right values reference std:: move()
Recyclerview sticky (suspended) head
2019.10.27 training summary
在实践中学习Spark计算框架(01)
2019.11.20 training summary
Solve the problem that zxing's QR code contains Chinese garbled code
Downloading and installing VMware (basic idea + detailed process)
Substring score - Ultra detailed version - the last programming challenge
Dynamic planning summary
《CLR via C#》读书笔记-加载与AppDomain
C#中Linq常用用法
BUUCTF RE-easyre
2019.11.3 learning summary
L2-026 small generation (25 points)
Nacos registry cluster
Simulation problem of two stacks









