我正在开发一个需要能够扫描多个长度/类型的I2of5条形码的应用程序。较长的条形码长14位,较短的条形码长4或10。
我设置了I2OF5解码器的参数以允许:
Barcode2 symbolBarcode2 = new Barcode2(Symbol.Barcode2.Devices.SupportedDevices[0]);
symbolBarcode2.Config.Decoders.I2OF5.MinLength = 4;
symbolBarcode2.Config.Decoders.I2OF5.MaxLength = 14;
我遇到扫描仪解码较长条码的部分扫描问题。将Min和Max设置为14可以解决此问题,但不再允许扫描较短的条形码。
14位数的条形码使用USS校验位。如果我打开I2of5参数中的USS校验位方案,它可以解决问题,因为部分扫描几乎不会有正确的校验位。但是10位和4位数的条形码不使用校验位,因此它们不再扫描。
有没有办法拥有多套I2of5参数?然后我可以创建一个最小和最大长度为14的USS打开,另一个最小和最大值为10且USS关闭,第三个最小值和最大值为4,同时USS关闭。 / p>
我相信Intermec API允许这样做,有多组活动参数,但无法在Motorola EMDK中找到方法。我使用的是.Net EMDK 2.7。
答案 0 :(得分:0)
将TextBox控件拖放到设备的Form上更简单,确保它具有焦点,然后处理TextChanged事件或添加计时器以每500毫秒读取TextBox的Text属性。
这两个事件(Timer Tick和TextBox TextChanged)都具有相同的签名,因此您甚至可以连接到同一个事件!
private const bool USETIMER = true;
private const int TIMER_MS = 500;
private System.Windows.Forms.Timer m_timer;
private TextBox txtBarcode;
public Form1() {
InitializeComponent();
if (USETIMER) {
m_timer = new System.Windows.Forms.Timer();
m_timer.Interval = TIMER_MS;
m_timer.Tick += new EventHandler(Barcode_Check);
m_timer.Enabled = true;
} else {
txtBarcode.TextChanged += new EventHandler(Barcode_Check);
}
}
private void Barcode_Check(object sender, EventArgs e) {
if (!String.IsNullOrEmpty(txtBarcode.Text)) {
// Process your barcode
}
}
您根本不需要使用他们的SDK。