Const
_GOOGLE_URL
As
String
=
"http://chart.googleapis.com/chart?chs={WIDTH}x{HEIGHT}&cht=qr&chl={DATA}"
Dim
_DATA
.Empty
Property
Data
Get
Return
End
Set
(value
)
_DATA = value
Private
Function
getQRURI()
_qrAddr
= _GOOGLE_URL.Replace(
"{WIDTH}"
,
Me
.Width.ToString).Replace(
"{HEIGHT}"
.Height.ToString)
_qrAddr = _qrAddr.Replace(
"{DATA}"
, WebUtility.UrlEncode(_DATA))
Protected
Overrides
Sub
OnPaint(e
PaintEventArgs)
MyBase
.OnPaint(e)
If
Is
Nothing
Then
Exit
client
New
WebClient()
bytes()
Byte
= client.DownloadData(getQRURI())
client.Dispose()
memStream
IO.MemoryStream(bytes)
bmp
Bitmap = Bitmap.FromStream(memStream)
memStream.Dispose()
e.Graphics.DrawImage(bmp, 0, 0)
Button1_Click(sender
Object
, e
EventArgs)
Handles
Button1.Click
QrBox1.Data = TextBox1.Text
QrBox1.Refresh()
Imports
System.Net
Public
Class
QRBox
()
InitializeComponent()
Congratulations on the guru award.
Great article.
Thank you, Andy!