C#. QR Code Generator Size Setting Tutorial

sample source code to generate 2D QR Code images and adjust barcode size in C# .NET

  • Simple to integrate into Micro Visual Studio 2005/2008/2010 and Visual C#.NET Framework
  • Easy to identify, encode variable characters, including numeric, byte, alphanumeric and Kanji characters
  • Provide 40 different size for QR Code barcodes, ranging from V1(21X21) to V40 (177X177)
  • Support correct QR Code errors in 4 levels: L, M, H, Q
  • Make Data Matrix barcodes according to the latest QR Code specification - ISO / IEC 18004 (2nd edition 2006-09-01)
  • Simple to append 16 QR Code symbols into a structured format
  • Rich customizable size, color, format, image properties provided for QR Code barcodes
  • Mature, easy-to-use QR Code barcode component used world-widely
  • Tutorial for QR Code Image Setting in Visual C#.NET
  • Tutorial for QR Code Data Encoding in Visual C#.NET

QR Code, also known as Denso Barcode, QRCode, Quick Response Code, is a kind of 2D (two dimensional) barcode widely used today.


QR Code Structure

QR Code Image Width Related Settings

W: the width of QR Code image (including quiet zone). Please see BarCodeWidth.

X: the width of QR Code module. Please see X.

Q: the width of the quiet zone; Qmin=4X. Please see Left & Right Margin.

Version: the version of QR Code, ranging from V1 to V40. Please see QR Code Version.

QR Code Image Height Related Settings

H: the height of QR Code image (including quiet zone). Please see BarCodeHeight.

Top & Bottom Margin: the height of the top & bottom quiet zone. Please see Top & Bottom Margin.

Version: the version of QR Code, ranging from V1 to V40. Please see QR Code Version.


Setting QR Code Barcode Size in C#

C# QR Code barcode provides a set of barcode size settings to specify you QR Code barcodes. Please download C# barcode component and install, copy those following code to your Visual Studio:

QRCode barcode = new QRCode();

barcode.QRCodeDataMode = QRCodeDataMode.Auto;

barcode.Data = "ONBARCODE";

Modify your QR Code barcodes by setting those following properties:


UOM is short for Unit of Measure, which is the unit of meature for all size related settings in the library. C# QR Code barcode provides 3 options: Pixel, Cm, and Inch. The default is Pixel.

barcode.UOM = UnitOfMeasure.PIXEL;

QR Code Version

QRCodeVersion is the different size of QR Code. C# QR Code barcode provides 40 types version from V1 (21x21) to V40 (177X177). The default in C# QR Code barcode is QRCodeVersion.V1.

barcode.QRCodeVersion = QRCodeVersion.V5;

Barcode Width & Height

BarcodeWidth is the QR Code barcode image width. The default in C# QR Code barcode is 0 (float).

BarcodeHeight is the QR Code barcode image height. The default in C# QR Code barcode is 0 (float).

barcode.BarcodeWidth = 0;

barcode.BarcodeHeigth =0;

Notice: if your setting is smaller than the barcode required minimum width and height, the library will automatically reset to barcode minimum width. Or you may enable AutoResize to automatically resize your QR Code barcode image.

Barcode Margin

BarcodeMargin is the white zone around the QR Code symbol. C# QR Code barcode provides 4 options: Left Margin, Right Margin, Top Margin and Bottom Margin. The default of these four margins are 0 (float).

barcode.TopMargin = 3;

barcode.BottomMargin = 3;

barcode.LeftMargin = 1;

barcode.RightMargin = 1;


X is the width and height of barcode bar module. The default in C# QR Code barcode is 2 (float).

barcode.X = 3;

OnBarcode is a market-leading provider of barcode generator, reader controls and components for ASP.NET, Windows Forms, WPF, as well Java, Android, iOS (iPhone, iPad) across all major enterprise development platforms. We provides high quality tutorials and guides for various linear, 2d barcode information, such as C# Barcode, QR Code C#, QR Code VB.NET, QR Code ASP.NET, QR Code .NET, ASP.NET Barcode. OnBarcode barcode products are supported by RasterEdge .NET HTML5 Document Viewer high quality C# Convert PDF to Tiff, C# Convert PDF to Word, C# Convert PDF to HTML, C# Convert PDF to Jpeg images, and their easy and simple documents, like C# PDF SDK, C# extract text from PDF, C# Compress PDF, Print PDF in C# and C# extract image from PDF.
Terms of Use | Privacy Policy
Copyright © OnBarcode.com . All rights reserved.