我开发了一个服装商店的应用程序以在该应用程序中打印发票我想使用条形码扫描仪从包含条形码的物料标签中自动收集信息并自动填充所有信息我的表格,然后打印发票。 请给出一些建议如何解决这个问题。 我也使用Microsoft.PointOfService库。在windows应用程序中使用条形码扫描器C#
0
A
回答
0
通常,条形码扫描器只是将所有识别的符号作为标准键盘输入发送。因此,当用户将注意力集中在应用程序中的文本字段并扫描条形码时,就像用户手动输入条形码符号并按“Enter”(或任何其他键,取决于扫描仪设置)一样。
1
假设在表单中有一个文本框,当条形码扫描时,它会在文本框中键入条形码字符。通常,一些扫描仪可以配置为在扫描结束时添加另一个字符,通常是新行字符。借此,您可以收听文本框的KeyPress事件,并处理新行字符。当它被触发时,那么你可以检索表单中的其他细节。
+0
谢谢您的回答 – 2013-02-26 10:28:27
0
我有一个类在我的个人图书馆,以检测扫描仪的工作原理:
public sealed class ScanReader
{
#region Delegates
public delegate void _DataLoaded(string ScannedData);
#endregion
private readonly double MyMaxMillisecondsBetweenPress;
private readonly List<Regex> MyRegex;
private readonly Timer TimeToNextKeyPress = new Timer();
private string CardBuff = string.Empty;
private bool FirstKeyPress = true;
private DateTime Stamp;
/// <summary>
/// ScanReader constructor
/// </summary>
/// <param name="Press"> Form where KeyPreview = true </param>
/// <param name="Regs"> Regular expressions for filtering scanned data</param>
/// <param name="MaxMillisecondsBetweenPress"> The maximum time between pressing the keys in milliseconds, default = 60 </param>
public ScanReader(Form form, List<Regex> Regs = null, double MaxMillisecondsBetweenPress = 0)
{
MyRegex = Regs ?? null;
MyMaxMillisecondsBetweenPress = MaxMillisecondsBetweenPress == 0 ? 60 : MaxMillisecondsBetweenPress;
form.KeyPress += KeyPressed;
TimeToNextKeyPress.Interval =
Convert.ToInt32(MyMaxMillisecondsBetweenPress + MyMaxMillisecondsBetweenPress*0.2);
TimeToNextKeyPress.Tick += TimeToNextKeyPress_Tick;
}
public event _DataLoaded OnDataLoaded;
private void TimeToNextKeyPress_Tick(object sender, EventArgs e)
{
TimeToNextKeyPress.Stop();
if (MyRegex.Count > 0)
{
foreach (Regex reg in MyRegex)
{
if (reg.IsMatch(CardBuff))
{
OnDataLoaded(CardBuff);
return;
}
}
}
else
OnDataLoaded(CardBuff);
}
private void KeyPressed(object sender, KeyPressEventArgs e)
{
if (FirstKeyPress)
{
Stamp = DateTime.Now;
FirstKeyPress = false;
CardBuff = e.KeyChar.ToString();
}
else
{
if ((DateTime.Now - Stamp).TotalMilliseconds < MyMaxMillisecondsBetweenPress)
{
Stamp = DateTime.Now;
CardBuff += e.KeyChar;
}
else
{
Stamp = DateTime.Now;
CardBuff = e.KeyChar.ToString();
}
}
TimeToNextKeyPress.Stop();
TimeToNextKeyPress.Start();
}
}
如何使用:
var myReader = new ScanReader(this, new List<Regex>
{
new Regex(@"296\d{13,13}"),
new Regex(@"K%.{5,34}"),
new Regex(@"C%.{5,34}"),
new Regex(@"E%.{5,34}"),
});
myReader.OnDataLoaded += FillControls;
相关问题
- 1. C条码扫描器应用程序#
- 2. 条形码扫描器zxing和neoreader在我的应用程序
- 3. 在winRT应用程序中使用条码扫描器
- 4. 在Android应用程序中使用内置的条形码扫描器
- 5. 运行Windows“条码扫描器示例”应用程序
- 6. Windows Mobile应用程序条码扫描与模拟器
- 7. 从.net(C#)windows应用程序中的条码扫描器中读取数据!
- 8. 在条形码扫描仪扫描时用java打印条码
- 9. 用vb.net扫描条形码
- 10. 条码扫描器在自己的Google Glass应用程序中
- 11. 在Java Web应用程序中集成条码扫描器
- 12. 使用扫描仪的Swing应用程序条形码阅读器
- 13. 在android应用程序中设置zxing 2.0条形码扫描器
- 14. 在Android上使用“Zxing的条形码扫描仪”应用程序
- 15. 从我的iOS应用程序中使用条形码扫描仪(如Grabba)
- 16. 如何在c#.net应用程序中使用扫描器
- 17. 使用zbar扫描条形码图像?
- 18. 使用QRScanner扫描线性条形码
- 19. 使用Python进行条形码扫描
- 20. 条码扫描器集成在PHP应用程序
- 21. 在Android应用程序中单击按钮时调用条形码扫描仪
- 22. 适用于JSF应用程序,Applet或JWS的条形码扫描器界面?
- 23. 如何在c#windows应用程序中使用条形码阅读器?
- 24. C编程的条码扫描器#
- 25. 从多个条形码扫描仪读取数据到C#应用程序
- 26. 如何将条码扫描器与android应用程序集成?
- 27. Windows Phone 8.1:使用ZXing.Net从相机扫描条形码
- 28. 如何在我的应用程序中嵌入条形码扫描仪?
- 29. 如何将条形码扫描器集成到玻璃应用程序
- 30. 如何将条形码扫描器与Web应用程序连接?
@亚历克斯·基谢廖夫感谢您的答复.. – 2013-02-26 10:30:07