Created
C# QR Codes
To create a QR code using C# or any .net language first go to http://code.google.com/p/zxing/ and download the C# library and build it. Direct link for version 2 source (http://code.google.com/p/zxing/downloads/detail?name=ZXing-2.0.zip&can=2&q=)
Add the zxing.dll file as a reference to your project.
using System.Drawing;
Bitmap bmp = QRCode("The Message To Encode");
public Bitmap QRCode(string codeMessage)
{
com.google.zxing.qrcode.QRCodeWriter writer = new com.google.zxing.qrcode.QRCodeWriter();
com.google.zxing.common.ByteMatrix matrix;
int size = 180;
matrix = writer.encode(codeMessage, com.google.zxing.BarcodeFormat.QR_CODE, size, size, null);
Bitmap img = new Bitmap(size, size);
Color Color = Color.FromArgb(0, 0, 0);
for (int y = 0; y < matrix.Height; ++y)
{
for (int x = 0; x < matrix.Width; ++x)
{
Color pixelColor = img.GetPixel(x, y);
//Find the colour of the dot
if (matrix.get_Renamed(x, y) == -1)
{
img.SetPixel(x, y, Color.White );
}
else
{
img.SetPixel(x, y, Color.Black);
}
}
}
return img;
}