UI control

You can draw 1D barcodes using Nutrient .NET SDK (formerly GdPicture.NET). The code snippet below draws a barcode in the area of a rectangle you select on the image:

/// <summary>
/// On the `mouseup` event on GdViewer, draw a 1D barcode.
/// </summary>
/// <param name=" eventSender ">The object the event has occurred on.
/// <param name=" eventArgs ">The event's data.
/// <remarks>
/// If no selection area was painted on the GdViewer, this event will do nothing.
/// </remarks>
public void Draw_Barcode(System.Object eventSender, System.EventArgs eventArgs)
{
// Initializing variables to hold the position of the selection area on the document.
int leftArea = 0;
int topArea = 0;
int widthArea = 0;
int heightArea = 0;
// Checking if a selection area has been painted on the GdViewer.
if (GdViewer1.IsRect())
{
// Getting the location of the selection on the document.
GdViewer1.GetRectCoordinatesOnDocument(ref leftArea, ref topArea, ref widthArea, ref heightArea);
Barcode1DWriterType barcodeType = Barcode1DWriterType.Barcode1DWriterCode128;
// Drawing the 1D barcode.
GdPictureStatus status = oGdPictureImaging.Barcode1DWrite(imageId, barcodeType, "GdPicture 1D Barcode", leftArea, topArea, widthArea, heightArea, oGdPictureImaging.ARGB(255, 0, 0, 0));
if (status != GdPictureStatus.OK)
{
MessageBox.Show("ERROR: " + status.ToString(), "Barcode Example", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
// Redrawing the whole image.
GdViewer1.Redraw();
}
}
}