[C#][VB.NET]产生 Barcode
一、问题描述
如何产生 BarCode
二、方法
处理此问题有两个重点 : BarCode 字型与 BarCode 数据前后要加 *
1. 下载与安装免费 BarCode 字型 (Code39)
http://www.squaregear.net/fonts/free3of9.shtml
2. 建立新项目,在 Form 中加入 TextBox1、Label1、Button1,在 Button1.Click 事件中,加入以下程序
VB.NET
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = "*" + UCase(TextBox1.Text) + "*"
Label1.Font = New Font("Free 3 of 9", 20, Label1.Font.Style, Label1.Font.Unit)
End Sub
C#
private void button1_Click(object sender, EventArgs e) { label1.Text = "*" + textBox1.Text.ToUpper() + "*"; label1.Font = new Font("Free 3 of 9", 20, label1.Font.Style, label1.Font.Unit); }
3. 执行结果
(1) 输入想要变成 Barcode 的文字到 TextBox1 中
(2) 按 Button1 产生 Barcode 于 Label1
三、相关连结与参考
MSDN 论坛 : 条码的制作问题