C# 使用ZXing.Net的Winforms ID条形码阅读器

C# 使用ZXing.Net的Winforms ID条形码阅读器,c#,winforms,reader,zxing.net,C#,Winforms,Reader,Zxing.net,我正在尝试使用带有ZXing.net库的WinC窗体应用程序制作IDs阅读器 我找到了一个像这样的简单例子,但效果并不好 两个结果总是空的 我正在努力找出问题所在 IBarcodeReader reader = new BarcodeReader(); reader.Options.PossibleFormats = new List<BarcodeFormat>(); reader.Options.PossibleFormats.Add(BarcodeFormat.PDF_417)

我正在尝试使用带有ZXing.net库的WinC窗体应用程序制作IDs阅读器

我找到了一个像这样的简单例子,但效果并不好 两个结果总是空的

我正在努力找出问题所在

IBarcodeReader reader = new BarcodeReader();
reader.Options.PossibleFormats = new List<BarcodeFormat>();
reader.Options.PossibleFormats.Add(BarcodeFormat.PDF_417);
reader.Options.PossibleFormats.Add(BarcodeFormat.RSS_14);
reader.Options.TryHarder = true;

var barcodeBitmap = (Bitmap)Image.FromFile("d:\\5.png");
var res1 = reader.Decode(barcodeBitmap);
var res2 = reader.DecodeMultiple(barcodeBitmap);

任何帮助

当结果为空时,表示图像无法解码为任何可能的格式。如果您不确定条形码/二维码的格式,只需删除所有预期格式,即可让其接受任何格式:

IBarcodeReader reader = new BarcodeReader();

using (var barcodeBitmap = (Bitmap)Image.FromFile(@"d:\5.png"))
{
    var result = reader.Decode(barcodeBitmap);
    if (result != null)
    {
        Console.WriteLine(result.Text);
        // You can also use the following to determine the Barcode format.
        Console.WriteLine(result.BarcodeFormat.ToString());
    }
}

如果你不知道是什么问题,我们怎么可能帮助你?运行此代码时会发生什么情况?这让我咯咯地笑:reader.Options.TryHarder=true@卡米洛·特列文托。。你是说真的吗??我写的结果总是空的,没有例外thrown@LarsTech这是sdk bro中的不动产,试试@LarsTech,IKR,显然开发者很难找到这个不动产的名称!谢谢你的建议。但这仍然是我回答的第一行。此外,如果您认为条形码图像应该能够解码,您可以回答您的问题并包括您正在使用的条形码图像。