USB有驱ID卡读卡器C#小程序开发
一:小程序开发环境和视频演示
开发平台: windows 11
先看一下效果:
123
二:小程序基本功能
程序实现基本功能:读卡号 ,让设备发出响声,读出设备唯一编号
读取ID卡卡号:
卡还在感应区内,需要拿起来重新刷:
读取设备唯一序列号:
三:小程序核心代码
namespace idcardreader
{partial class Form1{/// <summary>/// 必需的设计器变量。/// </summary>private System.ComponentModel.IContainer components = null;/// <summary>/// 清理所有正在使用的资源。/// </summary>/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>protected override void Dispose(bool disposing){if (disposing && (components != null)){components.Dispose();}base.Dispose(disposing);}#region Windows 窗体设计器生成的代码/// <summary>/// 设计器支持所需的方法 - 不要/// 使用代码编辑器修改此方法的内容。/// </summary>private void InitializeComponent(){this.button2 = new System.Windows.Forms.Button();this.button4 = new System.Windows.Forms.Button();this.button6 = new System.Windows.Forms.Button();this.button7 = new System.Windows.Forms.Button();this.SuspendLayout();// // button2// this.button2.Location = new System.Drawing.Point(30, 19);this.button2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);this.button2.Name = "button2";this.button2.Size = new System.Drawing.Size(244, 42);this.button2.TabIndex = 1;this.button2.Text = "读卡";this.button2.UseVisualStyleBackColor = true;this.button2.Click += new System.EventHandler(this.button2_Click);// // button4// this.button4.Location = new System.Drawing.Point(294, 19);this.button4.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);this.button4.Name = "button4";this.button4.Size = new System.Drawing.Size(325, 42);this.button4.TabIndex = 3;this.button4.Text = "仅读一次,重新取放卡才能读到第二次";this.button4.UseVisualStyleBackColor = true;this.button4.Click += new System.EventHandler(this.button4_Click);// // button6// this.button6.Location = new System.Drawing.Point(30, 153);this.button6.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);this.button6.Name = "button6";this.button6.Size = new System.Drawing.Size(589, 42);this.button6.TabIndex = 5;this.button6.Text = "读出设备全球唯一的设备编号,作为加密狗用";this.button6.UseVisualStyleBackColor = true;this.button6.Click += new System.EventHandler(this.button6_Click);// // button7// this.button7.Location = new System.Drawing.Point(199, 89);this.button7.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);this.button7.Name = "button7";this.button7.Size = new System.Drawing.Size(244, 42);this.button7.TabIndex = 6;this.button7.Text = "让设备发出声响";this.button7.UseVisualStyleBackColor = true;this.button7.Click += new System.EventHandler(this.button7_Click);// // Form1// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;this.ClientSize = new System.Drawing.Size(645, 221);this.Controls.Add(this.button7);this.Controls.Add(this.button6);this.Controls.Add(this.button4);this.Controls.Add(this.button2);this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);this.Name = "Form1";this.Text = "ID读卡器例子程序";this.Load += new System.EventHandler(this.Form1_Load);this.ResumeLayout(false);}#endregionprivate System.Windows.Forms.Button button2;private System.Windows.Forms.Button button4;private System.Windows.Forms.Button button6;private System.Windows.Forms.Button button7;}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("idcardreader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("idcardreader")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("fb7a443b-4a1c-4c4e-aa9a-5c151fa852a7")]// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
USB免驱ID读卡器图片
资料下载:USB免驱ID通用读卡器ID-01H (Windows、Android、Linux、Web)_广州荣士电子公司
需要购买这款读卡器的朋友也可以评论区联系我