standinterfaceframe.cs
来自「独立完成考勤管理软件加打卡系统(C#) 是打卡加管理系统软件 」· CS 代码 · 共 1,369 行 · 第 1/4 页
CS
1,369 行
#region 命名空间
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Diagnostics.SymbolStore;
using System.Configuration.Assemblies;
using System.CodeDom;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Data;
using System.Data.SqlClient;
#endregion
namespace WindowsApplication
{
#region 主类
public class StandInterfaceFrame : System.Windows.Forms.Form
{
#region 控件声明...
public static bool f=false;
public static string strReserice="";
public static string strNumber="";
public static string strResericePortIdData="";
public static string strTime="";
public static string tempTimeStr="";
public static string tempDateStr="";
private System.Windows.Forms.Label label2;
//protected AxMSCommLib.AxMSComm axCom;
protected System.Windows.Forms.Timer timer;
public System.Windows.Forms.Button btnResevice;
private System.Windows.Forms.TextBox textReceive;
public System.Windows.Forms.Button BtnCloseCom;
private System.Windows.Forms.Button btnOpenCom;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
public System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.TextBox textTime;
protected System.Windows.Forms.Timer currentTime;
public System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.Label label5;
public System.Windows.Forms.Button btnLate;
public System.Windows.Forms.Button btnCanel;
public System.Windows.Forms.Button btnCome;
private System.Windows.Forms.ComboBox textBrushText;
public System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox textInformation;
public System.Windows.Forms.Button btnUnCome;
//private AxMSCommLib.AxMSComm axMsCom;
// private AxMSCommLib.AxMSComm axMSComm1;
//private AxMSCommLib.AxMSComm axMSComm2;
private System.ComponentModel.IContainer components;
#endregion
#region 构造函数...
public StandInterfaceFrame()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#endregion
#region 变量定义
public static string strEmpID="";
#endregion
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(StandInterfaceFrame));
this.label2 = new System.Windows.Forms.Label();
this.textReceive = new System.Windows.Forms.TextBox();
this.BtnCloseCom = new System.Windows.Forms.Button();
this.timer = new System.Windows.Forms.Timer(this.components);
this.btnResevice = new System.Windows.Forms.Button();
this.btnOpenCom = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.textTime = new System.Windows.Forms.TextBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.currentTime = new System.Windows.Forms.Timer(this.components);
this.btnAdd = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
this.btnLate = new System.Windows.Forms.Button();
this.btnCome = new System.Windows.Forms.Button();
this.btnCanel = new System.Windows.Forms.Button();
this.textBrushText = new System.Windows.Forms.ComboBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
//this.axMSComm2 = new AxMSCommLib.AxMSComm();
this.textInformation = new System.Windows.Forms.TextBox();
this.btnUnCome = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
//((System.ComponentModel.ISupportInitialize)(this.axMSComm2)).BeginInit();
this.SuspendLayout();
//
// label2
//
this.label2.BackColor = System.Drawing.Color.White;
this.label2.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label2.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(0)), ((System.Byte)(64)));
this.label2.Location = new System.Drawing.Point(216, 48);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(75, 17);
this.label2.TabIndex = 6;
this.label2.Text = "接收卡区:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textReceive
//
this.textReceive.BackColor = System.Drawing.Color.White;
this.textReceive.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textReceive.Location = new System.Drawing.Point(232, 80);
this.textReceive.Name = "textReceive";
this.textReceive.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textReceive.Size = new System.Drawing.Size(168, 21);
this.textReceive.TabIndex = 5;
this.textReceive.Text = "";
this.textReceive.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textReceive_KeyDown);
//
// BtnCloseCom
//
this.BtnCloseCom.BackColor = System.Drawing.Color.White;
this.BtnCloseCom.Cursor = System.Windows.Forms.Cursors.Hand;
this.BtnCloseCom.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.BtnCloseCom.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.BtnCloseCom.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(0)), ((System.Byte)(64)));
this.BtnCloseCom.Location = new System.Drawing.Point(328, 272);
this.BtnCloseCom.Name = "BtnCloseCom";
this.BtnCloseCom.Size = new System.Drawing.Size(72, 24);
this.BtnCloseCom.TabIndex = 8;
this.BtnCloseCom.Text = "关闭端口";
this.BtnCloseCom.Click += new System.EventHandler(this.BtnCloseCom_Click);
this.BtnCloseCom.MouseEnter += new System.EventHandler(this.BtnCloseCom_MouseEnter);
this.BtnCloseCom.MouseLeave += new System.EventHandler(this.BtnCloseCom_MouseLeave);
//
// timer
//
this.timer.Enabled = true;
this.timer.Interval = 1000;
this.timer.Tick += new System.EventHandler(this.timer_Tick);
//
// btnResevice
//
this.btnResevice.BackColor = System.Drawing.Color.White;
this.btnResevice.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnResevice.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnResevice.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnResevice.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(0)), ((System.Byte)(64)));
this.btnResevice.Location = new System.Drawing.Point(120, 424);
this.btnResevice.Name = "btnResevice";
this.btnResevice.Size = new System.Drawing.Size(72, 24);
this.btnResevice.TabIndex = 9;
this.btnResevice.Text = "接收";
this.btnResevice.Visible = false;
this.btnResevice.Click += new System.EventHandler(this.btnResevice_Click);
this.btnResevice.MouseEnter += new System.EventHandler(this.BtnCloseCom_MouseEnter);
this.btnResevice.MouseLeave += new System.EventHandler(this.BtnCloseCom_MouseLeave);
//
// btnOpenCom
//
this.btnOpenCom.BackColor = System.Drawing.Color.White;
this.btnOpenCom.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnOpenCom.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnOpenCom.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnOpenCom.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(0)), ((System.Byte)(64)));
this.btnOpenCom.Location = new System.Drawing.Point(232, 272);
this.btnOpenCom.Name = "btnOpenCom";
this.btnOpenCom.Size = new System.Drawing.Size(72, 24);
this.btnOpenCom.TabIndex = 10;
this.btnOpenCom.Text = "打开端口";
this.btnOpenCom.Click += new System.EventHandler(this.btnOpenCom_Click);
this.btnOpenCom.MouseEnter += new System.EventHandler(this.BtnCloseCom_MouseEnter);
this.btnOpenCom.MouseLeave += new System.EventHandler(this.BtnCloseCom_MouseLeave);
//
// label1
//
this.label1.BackColor = System.Drawing.SystemColors.InactiveCaption;
this.label1.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label1.Location = new System.Drawing.Point(0, 440);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(75, 17);
this.label1.TabIndex = 12;
this.label1.Text = "多少字节数:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(32, 448);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(67, 21);
this.textBox1.TabIndex = 14;
this.textBox1.Text = "textBox1";
//
// label3
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label3.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.label3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label3.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.label3.Location = new System.Drawing.Point(0, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(514, 32);
this.label3.TabIndex = 15;
this.label3.Text = "接收卡号";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label4
//
this.label4.BackColor = System.Drawing.Color.White;
this.label4.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label4.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(0)), ((System.Byte)(64)));
this.label4.Location = new System.Drawing.Point(216, 112);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(75, 17);
this.label4.TabIndex = 17;
this.label4.Text = "接收时间:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textTime
//
this.textTime.BackColor = System.Drawing.Color.White;
this.textTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textTime.Location = new System.Drawing.Point(232, 144);
this.textTime.Name = "textTime";
this.textTime.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textTime.Size = new System.Drawing.Size(168, 21);
this.textTime.TabIndex = 18;
this.textTime.Text = "";
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(8, 24);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(208, 232);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.TabIndex = 19;
this.pictureBox1.TabStop = false;
//
// currentTime
//
this.currentTime.Enabled = true;
this.currentTime.Interval = 1000;
this.currentTime.Tick += new System.EventHandler(this.currentTime_Tick);
//
// btnAdd
//
this.btnAdd.BackColor = System.Drawing.Color.White;
this.btnAdd.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAdd.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnAdd.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(0)), ((System.Byte)(64)));
this.btnAdd.Location = new System.Drawing.Point(224, 424);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(72, 24);
this.btnAdd.TabIndex = 20;
this.btnAdd.Text = "刷卡";
this.btnAdd.Visible = false;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
this.btnAdd.MouseEnter += new System.EventHandler(this.BtnCloseCom_MouseEnter);
this.btnAdd.MouseLeave += new System.EventHandler(this.BtnCloseCom_MouseLeave);
//
// label5
//
this.label5.BackColor = System.Drawing.Color.White;
this.label5.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label5.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(0)), ((System.Byte)(64)));
this.label5.Location = new System.Drawing.Point(216, 176);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(75, 17);
this.label5.TabIndex = 21;
this.label5.Text = "刷卡日期:";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnLate
//
this.btnLate.BackColor = System.Drawing.Color.White;
this.btnLate.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnLate.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLate.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnLate.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(0)), ((System.Byte)(64)));
this.btnLate.Location = new System.Drawing.Point(424, 80);
this.btnLate.Name = "btnLate";
this.btnLate.Size = new System.Drawing.Size(72, 24);
this.btnLate.TabIndex = 23;
this.btnLate.Text = "迟到";
this.btnLate.Click += new System.EventHandler(this.btnLate_Click);
this.btnLate.MouseEnter += new System.EventHandler(this.BtnCloseCom_MouseEnter);
this.btnLate.MouseLeave += new System.EventHandler(this.BtnCloseCom_MouseLeave);
//
// btnCome
//
this.btnCome.BackColor = System.Drawing.Color.White;
this.btnCome.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCome.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCome.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnCome.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(0)), ((System.Byte)(64)));
this.btnCome.Location = new System.Drawing.Point(424, 208);
this.btnCome.Name = "btnCome";
this.btnCome.Size = new System.Drawing.Size(72, 24);
this.btnCome.TabIndex = 24;
this.btnCome.Text = "已到";
this.btnCome.Click += new System.EventHandler(this.btnCome_Click);
this.btnCome.MouseEnter += new System.EventHandler(this.BtnCloseCom_MouseEnter);
this.btnCome.MouseLeave += new System.EventHandler(this.BtnCloseCom_MouseLeave);
//
// btnCanel
//
this.btnCanel.BackColor = System.Drawing.Color.White;
this.btnCanel.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCanel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCanel.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnCanel.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(0)), ((System.Byte)(64)));
this.btnCanel.Location = new System.Drawing.Point(424, 272);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?