使用ThoughtWorks.QRCode生成二维码
2024-09-24 18:41:12
新建Windows应用程序,加入引用ThoughtWorks.QRCode.dll,编写代码生成二维码。
using System;
using System.Drawing;
using System.Windows.Forms;
using ThoughtWorks.QRCode.Codec;
namespace QcCodeCreaterExp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Image image;
try
{
QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();
qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE;
qrCodeEncoder.QRCodeScale = Convert.ToInt32(TextBox_QrCodeSize.Text);//尺寸
qrCodeEncoder.QRCodeVersion = Convert.ToInt32(TextBox_QrCodeVersion.Text);//版本号
qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;
image = qrCodeEncoder.Encode(TextBox_QrCodeContent.Text);
}
catch (Exception ex)
{
image = null;
}
if (image != null)
{
pictureBox1.Image = image;
}
}
}
}
以我博客地址为内容生成二维码,以下是执行效果图。
快拿手机来扫一扫吧。
最新文章
- taskkill批量删除进程命令
- (Python )运算符
- spring 定时任务标注
- Hadoop 重启各个节点
- cocos中使用VS自动创建工程的方法
- 谈谈MVVM和链式网络请求架构
- jquery validate 配合ligerui使用
- china-pub
- EasyUI - Messager消息框
- acdream 1222 Quantization Problem [dp]
- hdu1255(线段树——矩形面积交)
- Gs_Class._BaseQueryWeb查询页面基类(aspx.net)
- 第六十七节,html表单元素
- 网页版Rstudio︱RStudio Server多人在线协作开发
- [WinForm]最小化到系统托盘,右键退出
- 斜率优化dp 的简单入门
- OpenGL矩阵变换,坐标空间变换
- iOS-iOS9系统SEGV_ACCERR问题处理【v3.6.3的一些bug修复】
- npm 报错unable to verify the first certificate
- OGG_Oracle GoldenGate简介(概念)