需要下载一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(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(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Panel1.Refresh()
End Sub
Private 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(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(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Panel1.Refresh()
End Sub
Private 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.运行效果
http://blog.csdn.net/tyouvivi/article/details/1613619
[本日志由 tiancao1001 于 2013-06-22 10:56 PM 编辑]
|
暂时没有评论
发表评论 - 不要忘了输入验证码哦! |