又找学习到一种简单的生成二维码插件
引用下载地址:https://pan.baidu.com/s/1rLcnSXtIy8HWe_pm_2OY6A
密码 :6t0i
附上代码如下
private void button1_Click(object sender, EventArgs e)
{
string Contents = this.textBox1.Text;
if (Contents!=string.Empty)
{
EncodingOptions options = new QrCodeEncodingOptions
{
DisableECI = true,
CharacterSet = "UTF-8",
Width = pictureBox1.Width,
Height = pictureBox1.Height
};
BarcodeWriter barcodeWriter = new BarcodeWriter
{
Format = BarcodeFormat.QR_CODE,
Options = options
};
Bitmap image = barcodeWriter.Write(Contents);
pictureBox1.Image = image;
}
else
{
MessageBox.Show("请输入内容");
}
}
效果图:
demo