当前位置:网站首页>界面仅允许扫码枪录入禁止手工键盘输入
界面仅允许扫码枪录入禁止手工键盘输入
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(); }
}边栏推荐
- Unity Animation从UAS获取动画资产到编制状态机控制简单的人物动画
- ZEMAX | 如何倾斜和偏心序列光学元件
- 【记录】把json的所有key转换成小写
- 全球一流医疗技术公司如何最大程度提高设计工作效率 | SOLIDWORKS 产品探索
- 数组与字符串15-最大连续1的个数
- go test执行多个文件夹下相同目录的用例
- classpath:与classpath*的比较
- ZEMAX | 在设计抬头显示器(HUD)时需要使用哪些工具?
- 5. What is the difference between int and Integer?
- 9. Please introduce the class loading process, what is the parent delegation model?
猜你喜欢
随机推荐
Delightful Nuxt3 Tutorial (2): Build a Blog Quickly and Easily
ARP协议及简单路由器原理(1)
嘿!selenium自动下载driver版本,得知道一下
802.1AS 时钟同步原理理解
Automatic ticket issuance based on direct reduction of China Southern Airlines app
contos安装php-ffmpeg和tp5.1使用插件
SolidWorks 操作视频 | 流体分析结果演示
classpath:与classpath*的比较
All-round interpretation of POE switches (middle)
【面试准备】游戏开发中的几个岗位分别做什么&考察侧重点
交换机access口,hybrid口,trunk口的区别
servlet learning (7) ServletContext
内网渗透之PPT票据传递攻击(Pass the Ticket)
C语言中打印字符数组出现乱码的问题(烫烫烫)
二分查找2 - x的平方根
MATLAB自带的dwt2和wavedec2函数实现基于小波变换的自适应阈值图像边缘检测
BOA服务器移植之嵌入式开发板(FS4412)
Phase Vocoder的补充完善,Matlab音频变速不变调、变调不变速
借助ginput函数在figure窗口实时读取、展示多条曲线的坐标值
How the world's leading medical technology company maximizes design productivity | SOLIDWORKS Product Exploration









