| 123456789101112131415161718192021222324252627282930313233343536373839 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using ZXing;
- using ZXing.QrCode;
- namespace Test.Qrcode
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- BarcodeWriter writer = new BarcodeWriter();
- writer.Format = BarcodeFormat.QR_CODE;
- QrCodeEncodingOptions options = new QrCodeEncodingOptions()
- {
- DisableECI = true,
- CharacterSet = "UTF-8",
- Width = pictureBox1.Width,
- Height = pictureBox1.Height,
- Margin = 1
- };
- writer.Options = options;
- Bitmap map = writer.Write("生成二维码测试");
- pictureBox1.Image = map;
- }
- }
- }
|