我已经显示了条形码,但是当我尝试为其分配一个值时,它不会出现在图像下方。格式必须为一维格式,但如果此格式不支持,则可以从code_128更改为其他格式。请参见下面的代码。(imageBarcode是我要在其上显示条形码的页面中“图像视图”的变量名。)
var barcodeWriter = new ZXing.Mobile.BarcodeWriter
{
Format = BarcodeFormat.CODE_128,
Options = new ZXing.Common.EncodingOptions
{
Width = 900,
Height = 300,
PureBarcode = false,
Margin = 6
}
};
var barcode = barcodeWriter.Write("123123123123");
imageBarcode.SetImageBitmap(barcode);
ZXing.Mobile项目的iOS和Android的位图渲染器类不支持将内容写入条形码下方。如果您使用的是Android,则可以尝试基础项目ZXing.Net(github.com/micjahn/ZXing.Net)的条形码编写器类。