快捷方式和条形码扫描仪
在我的 WPF 应用程序中,我有一个菜单。该菜单中的选项之一分配有快捷键:CTRL+B。在我的应用程序中,我还需要能够使用条形码扫描仪扫描条形码。 我的条形码配置方式是使用 CTRL+B 组合来指定条形码起点。换句话说:条形码扫描仪发送 CTRL+B 组合来告诉我:“嘿,我现在开始向您发送条形码数字”。
我在 Window_PreviewKeyDown 事件处理程序上监听条形码输入。然而,这不起作用,因为首先,应用程序识别出 CTRL+B 被按下,并想要调用与快捷方式 CTRL+B 关联的命令执行方法。有没有办法在不改变快捷方式的情况下解决这个问题?
In my WPF Application I have a menu. One of the option from that menu has a shortcut assigned: CTRL+B. In my application I also need a possibility to scan a bar code using bar code scanner.
My bar code is configured in a way where CTRL+B combination is used to specify the bar code starting point. In other words: Bar code scanner sends CTRL+B combination to tell me: "Hey I now starting to send you the bar code numbers".
I listening for the bar code input on Window_PreviewKeyDown
event handler. This however does not work because firstly, application recognizes that CTRL+B was pressed and wants to call the command's executed method associated with the shortcut CTRL+B. Is there a way to have a solution for this issue without changing the shortcut?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以更改条形码扫描仪配置以在开始时发送一些其他密钥。
大多数条形码扫描仪都提供配置手册,您可以在其中设置此类设置。
请注意,当用户更换扫描仪或有多个用户使用不同的扫描仪时,处理条形码扫描仪中的特定字符可能会导致一些问题。
You may change the barcode scanner configuration to send some other keys at start.
Most barcode scanners provide a configuration manual where you can set such settings.
Please note that handling specific characters from barcode scanners can cause some trouble when the user changes his scanner or you have multiple users using different scanners.