using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Leadtools;
using Leadtools.Barcode;
using Leadtools.Forms;
using Leadtools.Codecs;
namespace testtm
{
public partial class MainForm : Form
{
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
private RasterCodecs _Codefile = new RasterCodecs();
void Button1Click(object sender, EventArgs e)
{
RasterImage image = imageViewer1.Image;
BarcodeEngine engine = new BarcodeEngine();
BarcodeData data = new BarcodeData();
data.Symbology = BarcodeSymbology.UPCA;
data.Value = "01234567890";
data.Bounds = new LogicalRectangle(10, 10, 600, 200, LogicalUnit.Pixel);
OneDBarcodeWriteOptions options = new OneDBarcodeWriteOptions();
options.EnableErrorCheck = true;
engine.Writer.WriteBarcode(image, data, options);
}
void Button2Click(object sender, EventArgs e)
{
string filepath=@"d:\123.tif";
imageViewer1.Image = _Codefile.Load(filepath, 1, CodecsLoadByteOrder.BgrOrGray, 1, 1);
}
void MainFormLoad(object sender, EventArgs e)
{
unlock();
}
}
以上就是全部代码 |