|
|
@@ -7,6 +7,7 @@ using System.IO;
|
|
|
using System.Linq;
|
|
|
using System.Runtime.InteropServices;
|
|
|
using System.Text;
|
|
|
+using Zen.Barcode;
|
|
|
using ZXing;
|
|
|
using ZXing.QrCode;
|
|
|
|
|
|
@@ -145,20 +146,19 @@ namespace UAS_Web.tool
|
|
|
public static void DrawBarcode(string str, ref Bitmap bitmap, double x, double y, double width, double height)
|
|
|
{
|
|
|
|
|
|
- QrCodeEncodingOptions options = new QrCodeEncodingOptions();
|
|
|
- options.Margin = 1;
|
|
|
- options.Width = (int)width * 4;
|
|
|
- options.Height = (int)height * 4;
|
|
|
- options.PureBarcode = true;
|
|
|
- BarcodeWriter writer = new BarcodeWriter();
|
|
|
- writer.Format = BarcodeFormat.CODE_128;
|
|
|
- writer.Options = options;
|
|
|
- Bitmap imgTemp = writer.Write(str);
|
|
|
- //BarCode _Code = new BarCode();
|
|
|
- //_Code.ValueFont = new Font(new FontFamily("黑体"), (float)(6 * 25.4 /18), FontStyle.Regular);
|
|
|
- //_Code.Height = 6*4;
|
|
|
- //Bitmap imgTemp = _Code.GetCodeImage("0012490202261807040001",
|
|
|
- //BarCode.Encode.Code128A);
|
|
|
+ //QrCodeEncodingOptions options = new QrCodeEncodingOptions();
|
|
|
+ //options.Margin = 1;
|
|
|
+ //options.Height = (int)height * 4;
|
|
|
+ //options.PureBarcode = true;
|
|
|
+ //BarcodeWriter writer = new BarcodeWriter();
|
|
|
+ //writer.Format = BarcodeFormat.CODE_128;
|
|
|
+ //writer.Options = options;
|
|
|
+ //Bitmap imgTemp = writer.Write(str);
|
|
|
+
|
|
|
+ Code128BarcodeDraw barcode128 = BarcodeDrawFactory.Code128WithChecksum;
|
|
|
+
|
|
|
+ Image imgTemp = barcode128.Draw(str, (int)height * 4);
|
|
|
+
|
|
|
bitmap = (Bitmap)CombinImage(bitmap, imgTemp, (float)x, (float)y);
|
|
|
}
|
|
|
|