VB二维码生成与解码的代码,特别支持中文的二维码编码和译码
代码片
下面展示一些 内联代码片
。
// VB 代码
//保存二维码图片
Private Sub Command1_Click()
Printer.ScaleMode = 6
Picture1.Picture = QRmaker1.Picture
CommonDialog1.DialogTitle = "保存二维码图片"
CommonDialog1.Filter = "All Files (*.*)|*.*|BMP Files (*.bmp)|*.bmp|JPGE Files (*.jpg)|*.jpg"
CommonDialog1.FilterIndex = 3
CommonDialog1.ShowSave
If CommonDialog1.FileName <> "" Then
SavePicture Picture1.Image, CommonDialog1.FileName
End If
End Sub
//Unicode解码得到中文
Private Sub DecodeTxt_Change()
S = HexToStr(DecodeTxt.Text)
' MsgBox S
ResultTxt.Text = S
End Sub
Private Sub Form_Load()
With QRmaker1
.ModelNo = 2
.CellPitch = 10
.CellUnit = 500
.QuietZone = 0
.InputData = "123abc!@?测试's developer"
.Refresh
End With
txtInputData.Text = "test12ab%!?测试's developer"
End Sub
Private Sub txtInputData_Click()
txtInputData.Text = ""
QRmaker1.Refresh
End Sub
//中文编码得到Unicode
Private Sub txtInputData_Change()
Dim S1 As String
S1 = StrToHex(txtInputData.Text)
QRmaker1.InputData = S1
QRmaker1.AutoRedraw = ArOn
End Sub
供交流分享,欢迎打赏,新手入门,攒攒积分。