当前位置:网站首页>界面仅允许扫码枪录入禁止手工键盘输入
界面仅允许扫码枪录入禁止手工键盘输入
2022-08-03 05:27:00 【谷凯Jump】
由于扫码枪和键盘都属于外设,对于应用程序来说,无法判断输入源。
可间接的通过按键时间来判断。
扫码枪速度大概在0-50ms之间,平均在8ms左右,手动输入在100-200之间,除非特地快速输入可达到30几ms。
我们取个适中的时间:50ms
DateTime dStart;
DateTime dEnd;
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
dStart = DateTime.Now;
}
private void textBox1_KeyUp(object sender, KeyEventArgs e)
{
dEnd = DateTime.Now;
if ((dEnd - dStart).TotalMilliseconds > 50) { textBox1.Clear(); }
}边栏推荐
猜你喜欢

大佬!Maya+ZBrush+Substance制作泰坦野兽全流程!

电子元器件和电子元件的区别有那些?

802.1AS的BMCA(最佳主时钟选举)理解

How the world's leading medical technology company maximizes design productivity | SOLIDWORKS Product Exploration

【随笔】小马过河

SolidWorks 操作视频 | 流体分析结果演示

All-round interpretation of POE switches (middle)

内网渗透信息收集

Dynamic adjustment of web theme (2) Extraction

VS2022 encapsulation under Windows dynamic library and dynamic library calls
随机推荐
BOA服务器移植之嵌入式开发板(FS4412)
Eight, the difference between the interface of the abstract class
window下VS2022封装静态库以及调用静态库
ZEMAX | 如何创建复杂的非序列物体
【七夕特效】 -- 满屏爱心
数组与字符串13-两数之和等于目标数
【C语言】关于数组传参问题/首地址
ue4学习日记2(项目迁移,画刷,附材质)
一文看懂常见域名后缀的含义
classpath:与classpath*的比较
什么是次世代建模,为什么这么多建模人在学习次世代建模流程
二分查找3 - 猜数字大小
守望先锋英雄角色模型分享,obj文件+材质贴图,3dmax游戏建模
Oracle常用命令-基本命令
Practice of MySql's Sql statement (try how many you can write)
影响PoE供电传输距离的除了网线还有啥?
二分查找6 - 寻找峰值
window下VS2022封装动态库以及调用动态库
Makefile.am:24: error: Libtool library used but ‘LIBTOOL‘ is undefined
申请公网ip后,配置光猫,路由器使用公网ip步骤