J4L Micro QRCode for .NET

Copyright J4L Components (http://www.java4less.com) 2013.

Introduction

The package Micro QRCode contains the classes you need to create Micro QRCode barcodes within your .NET applications.

The Micro QR Code format (also specified in the International Standard), is a variant of QR Code with a reduced number of overhead modules and a restricted range of sizes. A single finder pattern, is located at the upper left corner of the symbol as illustrated in the following figure.

Micro QR Code symbols have 4 version (version 1 to 4). The sizes of the barcodes are:

The maximum barcode capacity of Micro QR Code the largest barcode symbol size, (Version 4  error correction level L):

Supports 4 error correction levels:

 

Sample Application

In order to run the sample application you must execute QRCodeDemo20.exe or QRCodeDemo4.exe.

 

 

In the sample application you can set all properties of the Micro QRCode symbology.

You can execute the following commands:

 

Micro QRCode class

The main class for creating Micro QRCode barcodes is J4L.MicroQRCode.MicroQRCode. It is a subclass of System.Windows.Forms.Control and can therefore be used for placing a barcode on a windows form.

The following properties allows you to configurate the barcode:

 

The following method can be used for painting the barcode on an external graphics object:

If you need to created a image file you can do it like this:

[C#]

using J4L.QMicroRCode;

...

// define variable
MicroQRCode bc;
// create instance of the objact
bc = new MicroQRCode();

// set barcode properties
bc.Code="12345678";

...



// set size and write to file
bc.Size = new System.Drawing.Size(368, 176);
bc.saveToFile("qrcode.gif","GIF");

[VBNET]

Imports J4L.MicroQRCode

......

' define variable
Dim bc as MicroQRCode
'create instance of the object
bc = new MicroQRCode()

' set barcode properties
bc.Code="12345678"
...

' set size and write to file
bc.Size = new System.Drawing.Size(368, 176)
bc.SaveToFile("qrcode.gif","GIF")

 

You can also use the paint() method for rendering the barcode onto an external Graphics object:

[C#]

using J4L.MicroQRCode;
using System.Drawing;

...

    // create image and graphics
    Bitmap inMemoryImage =new Bitmap(300,300) ;
    Graphics g= Graphics.FromImage(inMemoryImage) ;

    // create barcode
    MicrpQRCode bc=new MicroQRCode();

// set barcode properties
bc.Size=new Size(300,300);
bcCode="12345678";
...


// render barcode on "g"
bc.paint(g);

[VBNET]

Imports J4L.MicroQRCode
Imports System.Drawing

..............

' create image and graphics
dim inMemoryImage as new Bitmap(300,300)
dim g as Graphics = Graphics.FromImage(inMemoryImage)

'create barcode
dim bc as MicroQRCode =new MicroQRCode()

' set barcode properties
bc.Size=new Size(300,300);
bc.Code="12345678"
...


'render barcode on "g"
bc.paint(g)

The windows forms control can be placed on a form with your IDE by just adding our controls to the toolbox. You can also programatically add controls to your form with the following code:

[C#]

using J4L.MicroQRCode;

...

// define variable
MicroQRCode bc;
// create instance of the objact
bc = new MicroQRCode();
// define position and size of the object on the form
bc.Location = new System.Drawing.Point(8, 8);
bc.Size = new System.Drawing.Size(368, 176);

// set barcode properties
bc.Code="12345678";
....

// add it to the form "this" is the current form.
this.Controls.Add(bc);

[VBNET]

Imports J4L.MicroQRCode

.....

' define variable
dim bc as MicroQRCode
'create instance of the objact
bc = new MicroQRCode()
'define position and size of the object on the form
bc.Location = new System.Drawing.Point(8, 8)
bc.Size = new System.Drawing.Size(368, 176)

' set barcode properties
bc.Code="12345678";
...

'add it to the form "me" is the current form.
me.Controls.Add(bc)

You can print the barcode by rendering in on the Graphics objects of the PrintDocument:

[C#]

void btnPrintClick(object sender, System.EventArgs e)
{
// create PrintDocument and set handler

PrintDocument printDocument1=new PrintDocument();
printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
printDocument1.Print();
}

private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
// print barcode here

bc.paint(e.Graphics);
}


Annex A

Table — Data capacity for Micro QRCode versions

 

Version
Error Correction Level

Numeric

Alphanumeric

Byte

Kanji

1

 

5

-

-

-

2

L
M

10
8

6
5

-

-

3

L
M

23
18

14
11

9
7

6
4

4

L
M
Q

35
30
21

 

21
18
13

 

15
13
9

 

9
8
5