1.安装SDK (EMDK-M-020900.exe)
2.添加组件 Symbol.dll (C:\Program Files (x86)\Motorola EMDK for .NET\v2.9\SDK\Smart Devices\)
添加组件 Symbol.Barcode2.DesignCF35.dll (C:\Program Files (x86)\Motorola EMDK for .NET\v2.9\SDK\Smart Devices\)
3. 设置barcode2组件 EnableScanner属性为true
4. 编写barcode2组件的OnScan事件
private void barcode21_OnScan(ScanDataCollection scanDataCollection)
{
ScanData scanData = scanDataCollection.GetFirst;
if (scanData.Result == Results.SUCCESS)
{
this.textBox1.Text = scanData.Text + ";" + scanData.Type.ToString();
}
}
5. 编写form的closed事件,关闭条码组件,释放资源:
private void FrmTest_Closed(object sender, EventArgs e)
{
// You must disable the scanner before exiting the application in
// order to release all the resources.
barcode21.EnableScanner = false;
this.Close();
}