怎样使用微信二维码生成器器

  二维码是用某种特定的几何图形按一定规律在平面(二维方向上)分布的黑白相间的图形记录数据符号信息的,国外对二维码技术的研究始于20世纪80年代末,在二维码符号表示技术研究方面已研制出多种码制,常见的有PDF417、QR Code、Code 49、Code 16K、Code One等。二维码技术已经被广泛应用于公安、外交、军事等部门对各类证件的管理,而且也将二维码应用于海关、税务等部门对各类报表和票据的管理,商业、交通运输等部门对商品及货物运输的管理、邮政部门对邮政包裹的管理、工业生产领域对工业生产线的自动化管理。
  下面介绍一下如何用.NET生成二维码(QR Code码制),下面给出详细步骤:
1、新建一个window应用程序,然后引入.NET二维码类库(开源的类库,可从网上下载):
2、构建UI界面,代码如下:
1 namespace WinQRCode
partial class Form1
/// &summary&
/// 必需的设计器变量。
/// &/summary&
private ponentModel.IContainer components = null;
/// &summary&
/// 清理所有正在使用的资源。
/// &/summary&
/// &param name="disposing"&如果应释放托管资源,为 true;否则为 false。&/param&
protected override void Dispose(bool disposing)
if (disposing && (components != null))
components.Dispose();
base.Dispose(disposing);
#region Windows 窗体设计器生成的代码
/// &summary&
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// &/summary&
private void InitializeComponent()
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.lbl解码信息 = new System.Windows.Forms.Label();
((ponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
// button1
this.button1.Location = new System.Drawing.Point(446, 31);
this.button1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(103, 37);
this.button1.TabIndex = 0;
this.button1.Text = "编码";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
// button2
this.button2.Location = new System.Drawing.Point(446, 81);
this.button2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(103, 37);
this.button2.TabIndex = 1;
this.button2.Text = "解码";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
// pictureBox1
this.pictureBox1.Location = new System.Drawing.Point(23, 117);
this.pictureBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(279, 253);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchI
this.pictureBox1.TabIndex = 2;
this.pictureBox1.TabStop = false;
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(18, 39);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(69, 25);
this.label1.TabIndex = 3;
this.label1.Text = "信息:";
// textBox1
this.textBox1.Location = new System.Drawing.Point(95, 37);
this.textBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(333, 31);
this.textBox1.TabIndex = 4;
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(18, 81);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(88, 25);
this.label2.TabIndex = 5;
this.label2.Text = "二维码:";
// lbl解码信息
this.lbl解码信息.AutoSize = true;
this.lbl解码信息.Location = new System.Drawing.Point(101, 81);
this.lbl解码信息.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbl解码信息.Name = "lbl解码信息";
this.lbl解码信息.Size = new System.Drawing.Size(0, 25);
this.lbl解码信息.TabIndex = 6;
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.F
this.ClientSize = new System.Drawing.Size(572, 384);
this.Controls.Add(this.lbl解码信息);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "Form1";
this.Text = "二维码";
((ponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label lbl解码信息;
图形如下所示:
3、编写 编码和解码按钮事件,进行编码和解码处理:
2 using System.Collections.G
3 using ponentM
4 using System.D
5 using System.D
6 using System.L
7 using System.T
8 using System.Windows.F
10 namespace WinQRCode
using ThoughtWorks.QRCode.C
using ThoughtWorks.QRCode.Codec.D
using ThoughtWorks.QRCode.Codec.U
using System.IO;
using PdfToI
public partial class Form1 : Form
public Form1()
InitializeComponent();
/// &summary&
/// &/summary&
/// &param name="sender"&&/param&
/// &param name="e"&&/param&
private void button1_Click(object sender, EventArgs e)
if (this.textBox1.Text != "")
Cursor.Current = Cursors.WaitC
if (textBox1.Text.Trim() == String.Empty)
MessageBox.Show("不能为空.");
QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();
qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE;
qrCodeEncoder.QRCodeScale = 4;
qrCodeEncoder.QRCodeVersion = 7;
qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;
System.Drawing.I
String data = textBox1.T
image = qrCodeEncoder.Encode(data);
//图片显示
this.pictureBox1.Image =
Cursor.Current = Cursors.D
/// &summary&
/// &/summary&
/// &param name="sender"&&/param&
/// &param name="e"&&/param&
private void button2_Click(object sender, EventArgs e)
Cursor.Current = Cursors.WaitC
Bitmap b = this.pictureBox1.Image as B
QRCodeDecoder decoder = new QRCodeDecoder();
String decodedString = decoder.decode(new QRCodeBitmapImage(b));
//显示解码信息
this.lbl解码信息.Text += decodedS
catch (Exception ex)
MessageBox.Show(ex.Message);
Cursor.Current = Cursors.D
private void Form1_Load(object sender, EventArgs e)
4、编译运行,如下图:
阅读(...) 评论()草料二维码生成器关于我们<div class="richtext_main" id="richtext_main" cli-data-statistics="16,4" qrtype="1" data-toggle="tooltip" data-html="true" data-placement="top" data-original-title="切换至带格式编辑">高级编辑内容过多,生成的二维码不易扫描,请使用活码左侧输入内容点击生成二维码左侧输入内容点击生成活码基本颜色LOGO美化器容错30%大小280 px 码制
上传 LOGO常用 LOGO取消
快速美化器
快速创建可重用的美化模版旧版高级美化器仅QR Code码制支持二维码美化11-0110-25为你提供各种场景的二维码应用服务建筑施工产品介绍企业宣传名片传递活动推广设备巡检建筑施工管理用二维码实现建筑施工项目的精细化管理,满足多样化场景需求。技术交底项目展示人员管理设备管理实测实量安全隐患排查施工质量管理使用功能产品与服务活码制作二维码美化工具和服务行业解决方案2,000,000+用户的信任用简单的方式使用二维码
服务支持咨询热线:400-002-0232投诉反馈:客服QQ:点击咨询销售咨询咨询热线:400-002-0232投诉反馈:跳转码、视频码、音乐码、
公测: 二维码可以转为小程序码了,
高级二维码
文本二维码(制作 网址、邮箱、电话 等二维码)
推荐150字内,超多文字或图文二维码请使用
正常用 PNG图,矢量图才用 SVG 和 EPS
定位点(外框)
定位点(内点)
二维码尺寸
建议尺寸比实际要大,如:1050 x 1050 px友情链接: |
&&&二维码软件定制(商务合作): 陈经理
请先关注公众号
关注后不再提示

我要回帖

更多关于 二维码生成器使用方法 的文章

 

随机推荐