As String ? ? ? ? Dim _qrAddr As String = _GOOGLE_URL.Replace("{WIDTH}", Me.Width.ToString).Replace("{HEIGHT}", Me.Height.ToString) ? ? ? ? _qrAddr = _qrAddr.Replace("{DATA}", WebUtility.UrlEncode(_DATA)) ? ? ? ? ? Return _qrAddr ? ? End Function ? ? ? Protected Overrides Sub OnPaint(e As PaintEventArgs) ? ? ? ? MyBase.OnPaint(e) ? ? ? ? If _DATA Is Nothing Then Exit Sub ? ? ? ? ? Dim client As New WebClient() ? ? ? ? Dim bytes() As Byte = client.DownloadData(getQRURI()) ? ? ? ? client.Dispose() ? ? ? ? ? Dim memStream As New IO.MemoryStream(bytes) ? ? ? ? Dim bmp As Bitmap = Bitmap.FromStream(memStream) ? ? ? ? memStream.Dispose() ? ? ? ? ? e.Graphics.DrawImage(bmp, 0, 0) ? ? End Sub ? ? ? Public Sub New() ? ? ? ? InitializeComponent() ? ? End Sub End Class
我希望本文对你的项目有用。
祝你编码愉快,工作愉快!
英文原文:Create QR Codes with Google Web APIs
|