样式条形码
在IronBarcode中,您可以灵活地调整条形码的大小、添加边距、更改颜色,并将它们保存在各种流行的文件格式中。 此外,您可以调整DPI设置以更精细地控制图像的细节。
using IronBarCode; using IronSoftware.Drawing; // Creating a barcode is as simple as: var myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8); // Resize: myBarcode.ResizeTo(400, 100); // Set Margins and Color for Barcode myBarcode.SetMargins(5, 5, 5, 5); myBarcode.ChangeBarCodeColor(Color.Red); // And save our barcode as an image: myBarcode.SaveAsImage("EAN8.jpeg"); // Another supported feature is MIL Sizing: // Barcode mils are used by the bar code scanner manufactures to state the minimum bar code bar width of one bar, and at what distance the barcode can be scanned. var barcodeResizeInMils = BarcodeWriter.CreateBarcode("5941623002802", BarcodeEncoding.Code128); // This will resize the Barcode with the MIL size 13 and the default height of 1 inch and default DPI of 96 barcodeResizeInMils.ResizeToMil(13); // This will resize the Barcode with the MIL size 10 and the expected height of 1.5 inch and default DPI of 96 barcodeResizeInMils.ResizeToMil(10, 1.5); // This will resize the Barcode with the MIL size 7.5 and the expected height of 2 inch and expected DPI of 200 barcodeResizeInMils.ResizeToMil(7.5, 2, 200);
Imports IronBarCode Imports IronSoftware.Drawing ' Creating a barcode is as simple as: Private myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8) ' Resize: myBarcode.ResizeTo(400, 100) ' Set Margins and Color for Barcode myBarcode.SetMargins(5, 5, 5, 5) myBarcode.ChangeBarCodeColor(Color.Red) ' And save our barcode as an image: myBarcode.SaveAsImage("EAN8.jpeg") ' Another supported feature is MIL Sizing: ' Barcode mils are used by the bar code scanner manufactures to state the minimum bar code bar width of one bar, and at what distance the barcode can be scanned. Dim barcodeResizeInMils = BarcodeWriter.CreateBarcode("5941623002802", BarcodeEncoding.Code128) ' This will resize the Barcode with the MIL size 13 and the default height of 1 inch and default DPI of 96 barcodeResizeInMils.ResizeToMil(13) ' This will resize the Barcode with the MIL size 10 and the expected height of 1.5 inch and default DPI of 96 barcodeResizeInMils.ResizeToMil(10, 1.5) ' This will resize the Barcode with the MIL size 7.5 and the expected height of 2 inch and expected DPI of 200 barcodeResizeInMils.ResizeToMil(7.5, 2, 200)
Install-Package BarCode
在IronBarcode中,您可以灵活地调整条形码的大小、添加边距、更改颜色,并将它们保存在各种流行的文件格式中。 此外,您可以调整DPI设置以更精细地控制图像的细节。