This example demonstrates how export barcodes to raster images. Enter some text in the text box on the right and click the Generate Image button.

| Language: C# |
using Nevron.Nov;
using Nevron.Nov.Barcode;
using Nevron.Nov.Dom;
using Nevron.Nov.Editors;
using Nevron.Nov.Graphics;
using Nevron.Nov.Layout;
using Nevron.Nov.UI;
using Nevron.Nov.Windows.Forms;
using System;
using System.Windows.Forms;
namespace NovWinFormsProject
{
public partial class Form1 : Form
{
#region Constructors
public Form1()
{
InitializeComponent();
// Set form title
Text = "NOV WinForms - NBarcodeImageExportExample";
// Create the NOV example and its controls
NWidget exampleContent = CreateExampleContent();
NWidget exampleControls = CreateExampleControls();
if (exampleControls != null)
{
exampleControls.PreferredWidth = 300;
}
// Place the example and its controls in a pair box
NPairBox pairBox = new NPairBox(exampleContent, exampleControls);
pairBox.FillMode = ENStackFillMode.First;
pairBox.FitMode = ENStackFitMode.First;
pairBox.Margins = new NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing);
// Host the example in the form
NNovWidgetHost host = new NNovWidgetHost(pairBox);
host.Dock = DockStyle.Fill;
Controls.Add(host);
}
#endregion
#region Example
private NWidget CreateExampleContent()
{
return null;
}
private NWidget CreateExampleControls()
{
return null;
}
#endregion
#region Implementation
#endregion
#region Event Handlers
private void OnBarcodeTextBoxTextChanged(NValueChangeEventArgs arg)
{
string text = (string)arg.NewValue;
m_GenerateImageButton.Enabled = text != null && text.Length > 0;
}
private void OnGenerateImageButtonClick(NEventArgs arg)
{
NMatrixBarcodePainter painter = new NMatrixBarcodePainter();
painter.Symbology = ENMatrixBarcodeSymbology.QrCode;
painter.Text = m_BarcodeTextBox.Text;
NRaster qrRaster = painter.CreateRaster(100, 100, NRaster.DefaultResolution);
NImage qrImage = new NImage(qrRaster);
m_ImageBox.Image = qrImage;
}
#endregion
#region Fields
private NImageBox m_ImageBox;
private NTextBox m_BarcodeTextBox;
private NButton m_GenerateImageButton;
#endregion
#region Static Methods
#endregion
#region Constants
#endregion
#region Nested Types
#endregion
}
}