Imports System.Text
Imports ThoughtWorks.QRCode.Codec
Imports ThoughtWorks.QRCode.Codec.Data
Public Class edit
Private Sub edit_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim erweima = New QRCodeEncoder()
erweima.QRCodeScale = 3 '大小(值越大生成的二维码图片像素越高,尺寸越大)
erweima.QRCodeVersion = 0 '版本
erweima.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.H '//错误效验、错误更正(有4个等级)
'L水平 7% 的字码可被修正
'M水平 15% 的字码可被修正
'Q水平 25% 的字码可被修正
'H水平 30% 的字码可被修正
PictureBox1.Image = erweima.Encode("这是一个字符串", Encoding.UTF8)
'识别二维码
Dim sb As QRCodeDecoder = New QRCodeDecoder()
Debug.Print(sb.decode(New QRCodeBitmapImage(PictureBox1.Image), System.Text.Encoding.UTF8))
End Sub
End Class
转载自https://blog.csdn.net/aa326358942/article/details/104651356