本文主要是介绍VS2005制作2维条码,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
VS2005制作2维条码
开发环境: VS2005
开发语言: VB.NET
需要下载一dll文件,地址如下
DotNetBarCode.zip
解压缩可以看到一dll文件 DotNetBarcode.dll
1.新建一VB.NET工程,在Form上新建一 按钮,文本框,一个Panel。
2.将下载下来的DotNetBarcode.dll 文件添加到工程的参照中去
3.添加事件,如下是代码,具体详细设置请自行更改
Dim bc1 As System.DotNetBarcode = New System.DotNetBarcode
Private Sub Form1_Load() Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
bc1.Type = System.DotNetBarcode.Types.QRCode
bc1.PrintCheckDigitChar = True
End Sub
Private Sub Button1_Click() Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Panel1.Refresh()
End Sub
Private Sub Panel1_Paint() Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
bc1.WriteBar(Me.TextBox1.Text, 0, 0, Me.Panel1.Size.Width, Me.Panel1.Size.Height, e.Graphics)
End Sub
Private Sub Form1_Load() Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
bc1.Type = System.DotNetBarcode.Types.QRCode
bc1.PrintCheckDigitChar = True
End Sub
Private Sub Button1_Click() Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Panel1.Refresh()
End Sub
Private Sub Panel1_Paint() Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
bc1.WriteBar(Me.TextBox1.Text, 0, 0, Me.Panel1.Size.Width, Me.Panel1.Size.Height, e.Graphics)
End Sub
4.运行效果
OK!
这篇关于VS2005制作2维条码的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!