ByteScout Premium Suite - C# - Display barcode on form with barcode sdk - ByteScout

ByteScout Premium Suite – C# – Display barcode on form with barcode sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Premium Suite – C# – Display barcode on form with barcode sdk

How to display barcode on form with barcode sdk in C# using ByteScout Premium Suite

If you want to learn more then this tutorial will show how to display barcode on form with barcode sdk in C#

An easy to understand sample source code to learn how to display barcode on form with barcode sdk in C# What is ByteScout Premium Suite? It is the bundle that includes twelve SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording. It can help you to display barcode on form with barcode sdk in your C# application.

The following code snippet for ByteScout Premium Suite works best when you need to quickly display barcode on form with barcode sdk in your C# application. Just copy and paste the code into your C# application’s code and follow the instructions. Enjoy writing a code with ready-to-use sample codes in C#.

You can download free trial version of ByteScout Premium Suite from our website to see and try many others source code samples for C#.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Form1.Designer.cs
      
namespace DisplayBarcodeOnForm { partial class Form1 { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.panel1 = new System.Windows.Forms.Panel(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // // pictureBox1 // this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.pictureBox1.Location = new System.Drawing.Point(12, 36); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(270, 270); this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; // // panel1 // this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panel1.Location = new System.Drawing.Point(314, 36); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(270, 270); this.panel1.TabIndex = 1; this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(12, 9); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(179, 13); this.label1.TabIndex = 2; this.label1.Text = "Show barcode in PictureBox control:"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(311, 9); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(157, 13); this.label2.TabIndex = 3; this.label2.Text = "Draw barcode on Panel control:"; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(599, 349); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.panel1); this.Controls.Add(this.pictureBox1); this.Name = "Form1"; this.Text = "Form1"; ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Form1.cs
      
using System.Drawing; using System.Windows.Forms; using Bytescout.BarCode; // This application demonstrates two ways how you can show the barcode on a form: // 1. using PictureBox control; // 2. painting it on a Panel control. namespace DisplayBarcodeOnForm { public partial class Form1 : Form { private Barcode _barcode = null; public Form1() { InitializeComponent(); // Create Barcode Generator instance _barcode = new Barcode(); _barcode.RegistrationName = "demo"; _barcode.RegistrationKey = "demo"; // Setup barcode _barcode.Symbology = SymbologyType.QRCode; _barcode.Value = "Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing"; // Put the barcode image to PictureBox pictureBox1.Image = _barcode.GetImage(); } // Paint the barcode image on a Panel control private void panel1_Paint(object sender, PaintEventArgs e) { Image barcodeImage = _barcode.GetImage(); e.Graphics.DrawImage(barcodeImage, 0, 0); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Program.cs
      
using System; using System.Collections.Generic; using System.Windows.Forms; namespace DisplayBarcodeOnForm { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next