当前位置:网站首页>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
边栏推荐
- mysql 8.0 一条insert语句的具体执行流程分析(二)
- std::make_shared<T>/std::make_unique<T>与std::shared_ptr<T>/std::unique_ptr<T>的区别与联系
- BUUCTF--新年快乐
- L2-025 分而治之 (25 分)
- Slide the custom control to close the activity control
- Substring score - Ultra detailed version - the last programming challenge
- std::unique_ptr<T>与boost::scoped_ptr<T>的特殊性
- Basic operations during dev use
- Analyze in detail the PBOT mining virus family behavior and the principle of exploited vulnerabilities, and provide detailed protection suggestions for the blue army
- September 29, 2020 non commodity templating code level rapidjson Library
猜你喜欢
随机推荐
Recyclerview sticky (suspended) head
BUUCTF--reverse2
云主机端口扫描
Ce projet Open source est super wow, des photos manuscrites sont générées en ligne
通过Win32API调用另一界面的按钮
Codeforces Round #645 (Div. 2)
Substring score - Ultra detailed version - the last programming challenge
L2-025 分而治之 (25 分)
We can't tell the difference between distributed and cluster. Let's tell the story of two cooks cooking
HDU 6778 car (group enumeration -- > shape pressure DP)
Basic operations during dev use
Use of Azkaban in task scheduler
這個開源項目超哇塞,手寫照片在線生成
AGCTFb部分题解
C#中IEqualityComparer接口的实现
mysql中的if [not] exists
MySQL innodb每行数据长度的限制
蛇形填数
解决zxing的QR码包含中文时乱码的问题
PGP在加密技术中的应用









