BarCodeReader

BarCodeReader()

Inizializza una nuova istanza diBarCodeReader classe con valori predefiniti. Richiede di impostare l’immagine (SetBitmapImage()) prima di chiamare il metodo ReadBarCodes().

public BarCodeReader()

Esempi

Questo esempio mostra come rilevare i codici a barre Code39 e Code128.

[C#]
using (BarCodeReader reader = new BarCodeReader())
{
    reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128);
    reader.SetBarCodeImage(@"c:\test.png");
    foreach (BarCodeResult result in reader.ReadBarCodes())
    {
        Console.WriteLine("BarCode Type: " + result.CodeTypeName);
        Console.WriteLine("BarCode CodeText: " + result.CodeText);
    }
}
[VB.NET]
Using reader As New BarCodeReader()
    reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128)
    reader.SetBarCodeImage("c:\test.png")
    For Each result As BarCodeResult In reader.ReadBarCodes()
        Console.WriteLine("BarCode Type: " + result.CodeTypeName)
        Console.WriteLine("BarCode CodeText: " + result.CodeText)
    Next
End Using

Guarda anche


BarCodeReader(Bitmap)

Inizializza una nuova istanza diBarCodeReader classe da un’immagine.

public BarCodeReader(Bitmap image)
ParametroTipoDescrizione
imageBitmapUn’istanza Bitmap contenente l’immagine

Esempi

Questo esempio mostra come rilevare i codici a barre Code39 e Code128.

[C#]
using (Bitmap bmp = new Bitmap(@"c:\test.png"))
using (BarCodeReader reader = new BarCodeReader(bmp))
{
    reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128);
    foreach (BarCodeResult result in reader.ReadBarCodes())
    {
        Console.WriteLine("BarCode Type: " + result.CodeTypeName);
        Console.WriteLine("BarCode CodeText: " + result.CodeText);
    }
}
[VB.NET]
Using bmp = New Bitmap("c:\test.png")
    Using reader As New BarCodeReader(bmp)
        reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128)
        For Each result As BarCodeResult In reader.ReadBarCodes()
            Console.WriteLine("BarCode Type: " + result.CodeTypeName)
            Console.WriteLine("BarCode CodeText: " + result.CodeText)
        Next
    End Using
End Using

Guarda anche


BarCodeReader(Bitmap, params BaseDecodeType[])

Inizializza una nuova istanza diBarCodeReader classe.

public BarCodeReader(Bitmap image, params BaseDecodeType[] decodeTypes)
ParametroTipoDescrizione
imageBitmapL’immagine.
decodeTypesBaseDecodeType[]Tipi di decodifica.

Esempi

Questo esempio mostra come rilevare i codici a barre Code39 e Code128.

[C#]
using (Bitmap bmp = new Bitmap(@"c:\test.png"))
using (BarCodeReader reader = new BarCodeReader(bmp, DecodeType.Code39Standard, DecodeType.Code128))
{
    foreach (BarCodeResult result in reader.ReadBarCodes())
    {
        Console.WriteLine("BarCode Type: " + result.CodeTypeName);
        Console.WriteLine("BarCode CodeText: " + result.CodeText);
    }
}
[VB.NET]
Using bmp = New Bitmap("c:\test.png")
    Using reader As New BarCodeReader(bmp, DecodeType.Code39Standard, DecodeType.Code128)
        For Each result As BarCodeResult In reader.ReadBarCodes()
            Console.WriteLine("BarCode Type: " + result.CodeTypeName)
            Console.WriteLine("BarCode CodeText: " + result.CodeText)
        Next
    End Using
End Using

Guarda anche


BarCodeReader(Bitmap, BaseDecodeType)

Inizializza una nuova istanza diBarCodeReader classe.

public BarCodeReader(Bitmap image, BaseDecodeType type)
ParametroTipoDescrizione
imageBitmapL’immagine.
typeBaseDecodeTypeIl tipo di decodifica1. Può essere singolo o multiplo

Esempi

Questo esempio mostra come rilevare i codici a barre Code39 e Code128.

[C#]
using (Bitmap bmp = new Bitmap(@"c:\test.png"))
using (BarCodeReader reader = new BarCodeReader(bmp, new MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128))
{
    foreach (BarCodeResult result in reader.ReadBarCodes())
    {
        Console.WriteLine("BarCode Type: " + result.CodeTypeName);
        Console.WriteLine("BarCode CodeText: " + result.CodeText);
    }
}
[VB.NET]
Using bmp = New Bitmap("c:\test.png")
    Using reader As New BarCodeReader(bmp, New MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128))
        For Each result As BarCodeResult In reader.ReadBarCodes()
            Console.WriteLine("BarCode Type: " + result.CodeTypeName)
            Console.WriteLine("BarCode CodeText: " + result.CodeText)
        Next
    End Using
End Using

Guarda anche


BarCodeReader(Bitmap, Rectangle, params BaseDecodeType[])

Inizializza una nuova istanza diBarCodeReader classe.

public BarCodeReader(Bitmap image, Rectangle area, params BaseDecodeType[] decodeTypes)
ParametroTipoDescrizione
imageBitmapL’immagine.
areaRectangleL’area per il riconoscimento.
decodeTypesBaseDecodeType[]Tipi di decodifica.

Esempi

Questo esempio mostra come rilevare i codici a barre Code39 e Code128.

[C#]
using (Bitmap bmp = new Bitmap(@"c:\test.png"))
using (BarCodeReader reader = new BarCodeReader(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height), DecodeType.Code39Standard, DecodeType.Code128)
{
    foreach (BarCodeResult result in reader.ReadBarCodes())
    {
        Console.WriteLine("BarCode Type: " + result.CodeTypeName);
        Console.WriteLine("BarCode CodeText: " + result.CodeText);
    }
}
[VB.NET]
Using bmp = New Bitmap("c:\test.png")
    Using reader As New BarCodeReader(bmp, New Rectangle(0, 0, bmp.Width, bmp.Height), DecodeType.Code39Standard, DecodeType.Code128)
        For Each result As BarCodeResult In reader.ReadBarCodes()
            Console.WriteLine("BarCode Type: " + result.CodeTypeName)
            Console.WriteLine("BarCode CodeText: " + result.CodeText)
        Next
    End Using
End Using

Guarda anche


BarCodeReader(Bitmap, Rectangle, BaseDecodeType)

Inizializza una nuova istanza diBarCodeReader classe.

public BarCodeReader(Bitmap image, Rectangle area, BaseDecodeType type)
ParametroTipoDescrizione
imageBitmapL’immagine.
areaRectangleL’area per il riconoscimento.
typeBaseDecodeTypeIl tipo di decodifica.

Esempi

Questo esempio mostra come rilevare i codici a barre Code39 e Code128.

[C#]
using (Bitmap bmp = new Bitmap(@"c:\test.png"))
using (BarCodeReader reader = new BarCodeReader(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height), new MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128))
{
    foreach (BarCodeResult result in reader.ReadBarCodes())
    {
        Console.WriteLine("BarCode Type: " + result.CodeTypeName);
        Console.WriteLine("BarCode CodeText: " + result.CodeText);
    }
}
[VB.NET]
Using bmp = New Bitmap("c:\test.png")
    Using reader As New BarCodeReader(bmp, New Rectangle(0, 0, bmp.Width, bmp.Height), New MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128))
        For Each result As BarCodeResult In reader.ReadBarCodes()
            Console.WriteLine("BarCode Type: " + result.CodeTypeName)
            Console.WriteLine("BarCode CodeText: " + result.CodeText)
        Next
    End Using
End Using

Guarda anche


BarCodeReader(Bitmap, Rectangle[], params BaseDecodeType[])

Inizializza una nuova istanza diBarCodeReader classe.

public BarCodeReader(Bitmap image, Rectangle[] areas, params BaseDecodeType[] decodeTypes)
ParametroTipoDescrizione
imageBitmapL’immagine da leggere
areasRectangle[]La matrice delle aree di riconoscimento
decodeTypesBaseDecodeType[]tipi di decodifica applicabili a tutte le aree specificate.

Esempi

Questo esempio mostra come rilevare i codici a barre Code39 e Code128.

[C#]
using (Bitmap bmp = new Bitmap(@"c:\test.png"))
using (BarCodeReader reader = new BarCodeReader(bmp, new Rectangle[] { new Rectangle(0, 0, bmp.Width, bmp.Height) }, DecodeType.Code39Standard, DecodeType.Code128)
{
    foreach (BarCodeResult result in reader.ReadBarCodes())
    {
        Console.WriteLine("BarCode Type: " + result.CodeTypeName);
        Console.WriteLine("BarCode CodeText: " + result.CodeText);
    }
}
[VB.NET]
Using bmp = New Bitmap("c:\test.png")
    Using reader As New BarCodeReader(bmp, New Rectangle() {New Rectangle(0, 0, bmp.Width, bmp.Height)}, DecodeType.Code39Standard, DecodeType.Code128)
        For Each result As BarCodeResult In reader.ReadBarCodes()
            Console.WriteLine("BarCode Type: " + result.CodeTypeName)
            Console.WriteLine("BarCode CodeText: " + result.CodeText)
        Next
    End Using
End Using

Guarda anche


BarCodeReader(Bitmap, Rectangle[], BaseDecodeType)

Inizializza una nuova istanza diBarCodeReader classe.

public BarCodeReader(Bitmap image, Rectangle[] areas, BaseDecodeType type)
ParametroTipoDescrizione
imageBitmapL’immagine da leggere
areasRectangle[]La matrice delle aree di riconoscimento
typeBaseDecodeTypeIl tipo di decodifica applicabile a tutte le aree specificate.

Esempi

Questo esempio mostra come rilevare i codici a barre Code39 e Code128.

[C#]
using (Bitmap bmp = new Bitmap(@"c:\test.png"))
using (BarCodeReader reader = new BarCodeReader(bmp, new Rectangle[] { new Rectangle(0, 0, bmp.Width, bmp.Height) }, new MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128))
{
    foreach (BarCodeResult result in reader.ReadBarCodes())
    {
        Console.WriteLine("BarCode Type: " + result.CodeTypeName);
        Console.WriteLine("BarCode CodeText: " + result.CodeText);
    }
}
[VB.NET]
Using bmp = New Bitmap("c:\test.png")
    Using reader As New BarCodeReader(bmp, New Rectangle() {New Rectangle(0, 0, bmp.Width, bmp.Height)}, New MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128))
        For Each result As BarCodeResult In reader.ReadBarCodes()
            Console.WriteLine("BarCode Type: " + result.CodeTypeName)
            Console.WriteLine("BarCode CodeText: " + result.CodeText)
        Next
    End Using
End Using

Guarda anche


BarCodeReader(string)

Inizializza una nuova istanza diBarCodeReader classe dal file.

public BarCodeReader(string filename)
ParametroTipoDescrizione
filenameStringIl nome del file.

Esempi

Questo esempio mostra come rilevare i codici a barre Code39 e Code128.

[C#]
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png"))
{
    reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128);
    foreach (BarCodeResult result in reader.ReadBarCodes())
    {
        Console.WriteLine("BarCode Type: " + result.CodeTypeName);
        Console.WriteLine("BarCode CodeText: " + result.CodeText);
    }
}
[VB.NET]
Using reader As New BarCodeReader("c:\test.png")
    reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128)
    For Each result As BarCodeResult In reader.ReadBarCodes()
        Console.WriteLine("BarCode Type: " + result.CodeTypeName)
        Console.WriteLine("BarCode CodeText: " + result.CodeText)
    Next
End Using

Guarda anche


BarCodeReader(string, params BaseDecodeType[])

Inizializza una nuova istanza diBarCodeReader classe.

public BarCodeReader(string filename, params BaseDecodeType[] decodeTypes)
ParametroTipoDescrizione
filenameStringIl nome del file.
decodeTypesBaseDecodeType[]Tipi di decodifica.

Esempi

Questo esempio mostra come rilevare i codici a barre Code39 e Code128.

[C#]
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39Standard, DecodeType.Code128))
{
    foreach (BarCodeResult result in reader.ReadBarCodes())
    {
        Console.WriteLine("BarCode Type: " + result.CodeTypeName);
        Console.WriteLine("BarCode CodeText: " + result.CodeText);
    }
}
[VB.NET]
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39Standard, DecodeType.Code128)
    For Each result As BarCodeResult In reader.ReadBarCodes()
        Console.WriteLine("BarCode Type: " + result.CodeTypeName)
        Console.WriteLine("BarCode CodeText: " + result.CodeText)
    Next
End Using

Guarda anche


BarCodeReader(string, BaseDecodeType)

Inizializza una nuova istanza diBarCodeReader classe.

public BarCodeReader(string filename, BaseDecodeType type)
ParametroTipoDescrizione
filenameStringIl nome del file.
typeBaseDecodeTypeIl tipo di decodifica.

Esempi

Questo esempio mostra come rilevare i codici a barre Code39 e Code128.

[C#]
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", new MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128)))
{
    foreach (BarCodeResult result in reader.ReadBarCodes())
    {
        Console.WriteLine("BarCode Type: " + result.CodeTypeName);
        Console.WriteLine("BarCode CodeText: " + result.CodeText);
    }
}
[VB.NET]
Using reader As New BarCodeReader("c:\test.png", New MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128))
    For Each result As BarCodeResult In reader.ReadBarCodes()
        Console.WriteLine("BarCode Type: " + result.CodeTypeName)
        Console.WriteLine("BarCode CodeText: " + result.CodeText)
    Next
End Using

Guarda anche


BarCodeReader(Stream)

Inizializza una nuova istanza diBarCodeReader classe.

public BarCodeReader(Stream stream)
ParametroTipoDescrizione
streamStreamIl flusso.

Esempi

Questo esempio mostra come rilevare i codici a barre Code39 e Code128.

[C#]
using (FileStream fstr = new FileStream(@"c:\test.png", FileMode.Open))
using (BarCodeReader reader = new BarCodeReader(fstr))
{
    reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128);
    foreach (BarCodeResult result in reader.ReadBarCodes())
    {
        Console.WriteLine("BarCode Type: " + result.CodeTypeName);
        Console.WriteLine("BarCode CodeText: " + result.CodeText);
    }
}
[VB.NET]
Using fstr = New FileStream("c:\test.png", FileMode.Open)
    Using reader As New BarCodeReader(fstr)
        reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128)
        For Each result As BarCodeResult In reader.ReadBarCodes()
            Console.WriteLine("BarCode Type: " + result.CodeTypeName)
            Console.WriteLine("BarCode CodeText: " + result.CodeText)
        Next
    End Using
End Using

Guarda anche


BarCodeReader(Stream, BaseDecodeType)

Inizializza una nuova istanza diBarCodeReader classe.

public BarCodeReader(Stream stream, BaseDecodeType type)
ParametroTipoDescrizione
streamStreamIl flusso.
typeBaseDecodeTypeIl tipo di decodifica.

Esempi

Questo esempio mostra come rilevare i codici a barre Code39 e Code128.

[C#]
using (FileStream fstr = new FileStream(@"c:\test.png", FileMode.Open))
using (BarCodeReader reader = new BarCodeReader(fstr, new MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128)))
{
    foreach (BarCodeResult result in reader.ReadBarCodes())
    {
        Console.WriteLine("BarCode Type: " + result.CodeTypeName);
        Console.WriteLine("BarCode CodeText: " + result.CodeText);
    }
}
[VB.NET]
Using fstr = New FileStream("c:\test.png", FileMode.Open)
    Using reader As New BarCodeReader(fstr, New MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128))
        For Each result As BarCodeResult In reader.ReadBarCodes()
            Console.WriteLine("BarCode Type: " + result.CodeTypeName)
            Console.WriteLine("BarCode CodeText: " + result.CodeText)
        Next
    End Using
End Using

Guarda anche


BarCodeReader(Stream, params BaseDecodeType[])

Inizializza una nuova istanza diBarCodeReader classe.

public BarCodeReader(Stream stream, params BaseDecodeType[] decodeTypes)
ParametroTipoDescrizione
streamStreamIl flusso.
decodeTypesBaseDecodeType[]Tipi di decodifica.

Esempi

Questo esempio mostra come rilevare i codici a barre Code39 e Code128.

[C#]
using (FileStream fstr = new FileStream(@"c:\test.png", FileMode.Open))
using (BarCodeReader reader = new BarCodeReader(fstr, DecodeType.Code39Standard, DecodeType.Code128))
{
    foreach (BarCodeResult result in reader.ReadBarCodes())
    {
        Console.WriteLine("BarCode Type: " + result.CodeTypeName);
        Console.WriteLine("BarCode CodeText: " + result.CodeText);
    }
}
[VB.NET]
Using fstr = New FileStream("c:\test.png", FileMode.Open)
    Using reader As New BarCodeReader(fstr, DecodeType.Code39Standard, DecodeType.Code128)
        For Each result As BarCodeResult In reader.ReadBarCodes()
            Console.WriteLine("BarCode Type: " + result.CodeTypeName)
            Console.WriteLine("BarCode CodeText: " + result.CodeText)
        Next
    End Using
End Using

Guarda anche