Link Search Menu Expand Document

Create Colored QR Code - C#

QR Code SDK sample in C# demonstrating ‘Create Colored QR Code’

Program.cs
using System.Diagnostics;
using System.Drawing;
using Bytescout.BarCode;

namespace ColoredQRCode
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create and activate QRCode instance
            using (QRCode barcode = new QRCode())
            {
                barcode.RegistrationName = "demo";
                barcode.RegistrationKey = "demo";

                // Set background color
                barcode.BackColor = Color.Yellow;
                // Set foreground color
                barcode.ForeColor = Color.Red;

                // Set value            
                barcode.Value = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 1234567890";
                
                // Save barcode to image
                barcode.SaveImage("result.png");
            }

            // Open the image in default image viewer (for demo purpose)
            Process.Start("result.png");
        }
    }
}

Download Source Code (.zip)

Return to the previous page Explore QR Code SDK