POS机C井例子代码(1)

这篇博客展示了如何使用C#进行POS机控制,包括端口打开、关闭、设备状态读取、时间设置等功能,涉及多种控件和方法的使用。
摘要由CSDN通过智能技术生成

 

 

 

 

 

 

详细代码

 

 

 

 

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

//广州荣士电子有限公司,联系电话020-82318861,82322852,定制13826029618 网址http://www.icmcu.com
namespace POS机C井例子代码
{
 /// <summary>
 /// Form1 的摘要说明。
 /// </summary>
 public class Form1 : System.Windows.Forms.Form
 {
  private System.Windows.Forms.Button button1;
  private System.Windows.Forms.Button button2;
  private System.Windows.Forms.GroupBox groupBox1;
  private System.Windows.Forms.Label label1;
  private System.Windows.Forms.Label label2;
  private System.Windows.Forms.Label label3;
  private System.Windows.Forms.Label label4;
  private System.Windows.Forms.Label label5;
  private System.Windows.Forms.Label label6;
  private System.Windows.Forms.Label label7;
  private System.Windows.Forms.Label label8;
  private System.Windows.Forms.TextBox textBox1;
  private System.Windows.Forms.TextBox textBox2;
  private System.Windows.Forms.TextBox textBox3;
  private System.Windows.Forms.TextBox textBox4;
  private System.Windows.Forms.TextBox textBox5;
  private System.Windows.Forms.TextBox textBox6;
  private System.Windows.Forms.Label label9;
  private System.Windows.Forms.Label label10;
  private System.Windows.Forms.Label label11;
  private System.Windows.Forms.TextBox textBox7;
  private System.Windows.Forms.TextBox textBox8;
  private System.Windows.Forms.TextBox textBox9;
  private System.Windows.Forms.TextBox textBox10;
  private System.Windows.Forms.TextBox textBox11;
  private System.Windows.Forms.TextBox textBox12;
  private System.Windows.Forms.TextBox textBox13;
  private System.Windows.Forms.Label label12;
  private System.Windows.Forms.Label label13;
  private System.Windows.Forms.Label label14;
  private System.Windows.Forms.Label label15;
  private System.Windows.Forms.Label label16;
  private System.Windows.Forms.Label label17;
  private System.Windows.Forms.Label label18;
  private System.Windows.Forms.Label label19;
  private System.Windows.Forms.Label label20;
  private System.Windows.Forms.Label label21;
  private System.Windows.Forms.Label label22;
  private System.Windows.Forms.TextBox textBox14;
  private System.Windows.Forms.TextBox textBox15;
  private System.Windows.Forms.TextBox textBox17;
  private System.Windows.Forms.TextBox textBox18;
  private System.Windows.Forms.Button button3;
  private System.Windows.Forms.Button button4;
  private System.Windows.Forms.Button button5;
  private System.Windows.Forms.Button button6;
  private System.Windows.Forms.Button button7;
  private System.Windows.Forms.Button button8;
  private System.Windows.Forms.Button button9;
  private System.Windows.Forms.GroupBox groupBox2;
  private System.Windows.Forms.Label label23;
  private System.Windows.Forms.Label label24;
  private System.Windows.Forms.Label label25;
  private System.Windows.Forms.Label label26;
  private System.Windows.Forms.Button button10;
  public  System.Windows.Forms.TextBox textBox16;
  private System.Windows.Forms.TextBox textBox19;
  private System.Windows.Forms.ComboBox comboBox1;
  private System.Windows.Forms.Button button11;
  private System.Windows.Forms.Button button12;
  private System.Windows.Forms.CheckBox checkBox1;
  private System.Windows.Forms.CheckBox checkBox2;
  private System.Windows.Forms.CheckBox checkBox3;
  private System.Windows.Forms.CheckBox checkBox4;
  private System.Windows.Forms.TextBox textBox20;
  private System.Windows.Forms.Label label27;
  private System.Windows.Forms.TextBox textBox21;
  private System.Windows.Forms.Label label28;
  private System.Windows.Forms.TextBox textBox22;
  private System.Windows.Forms.Label label29;
  private System.Windows.Forms.TextBox textBox23;
  private System.Windows.Forms.TextBox textBox24;
  private System.Windows.Forms.Label label30;
  private System.Windows.Forms.Button button13;
  private System.Windows.Forms.Button button14;
  private System.Windows.Forms.Label label31;
  private System.Windows.Forms.TextBox textBox25;
  private System.Windows.Forms.Button button15;
  private System.Windows.Forms.Button button16;
  private System.Windows.Forms.Button button17;
  private System.Windows.Forms.Label label32;
  private System.Windows.Forms.ComboBox comboBox2;
  private System.Windows.Forms.Label label33;
  private System.Windows.Forms.TextBox textBox26;
  private System.Windows.Forms.Button button18;
  private System.Windows.Forms.Button button19;
  private System.Windows.Forms.TextBox textBox27;
  private System.Windows.Forms.TextBox textBox28;
  private System.Windows.Forms.Button button20;
  private System.Windows.Forms.Label label34;
  private System.Windows.Forms.Button button21;
  private System.Windows.Forms.ListView listView1;
  private System.Windows.Forms.Label label35;
  private System.Windows.Forms.Label label36;
  private System.Windows.Forms.Label label37;
  private System.Windows.Forms.Label label38;
  private System.Windows.Forms.Label label39;
  private System.Windows.Forms.Label label40;
  private System.Windows.Forms.TextBox textBox29;
  private System.Windows.Forms.TextBox textBox30;
  private System.Windows.Forms.TextBox textBox31;
  private System.Windows.Forms.TextBox textBox32;
  private System.Windows.Forms.TextBox textBox33;
  private System.Windows.Forms.TextBox textBox34;
  private System.Windows.Forms.TextBox textBox35;
  private System.Windows.Forms.TextBox textBox36;
  private System.Windows.Forms.TextBox textBox37;
  private System.Windows.Forms.TextBox textBox38;
  private System.Windows.Forms.Button button22;
  private System.Windows.Forms.Button button23;
  private System.Windows.Forms.CheckBox checkBox5;
  private System.Windows.Forms.CheckBox checkBox6;
  private System.Windows.Forms.CheckBox checkBox7;
  private System.Windows.Forms.CheckBox checkBox8;
  private System.Windows.Forms.ColumnHeader columnHeader1;
  private System.Windows.Forms.ColumnHeader columnHeader2;
  private System.Windows.Forms.ColumnHeader columnHeader3;
  private System.Windows.Forms.ColumnHeader columnHeader4;
  private System.Windows.Forms.ColumnHeader columnHeader5;
  private System.Windows.Forms.ColumnHeader columnHeader6;
  private System.Windows.Forms.ColumnHeader columnHeader7;
  public  AxPOS01Lib.AxPOS01 axPOS011;

  /// <summary>
  /// 必需的设计器变量。
  /// </summary>
  private System.ComponentModel.Container components = null;

  public Form1()
  {
   //
   // Windows 窗体设计器支持所必需的
   //
   InitializeComponent();

   //
   // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
   //
  }

  /// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if (components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }

  #region Windows 窗体设计器生成的代码
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {
   System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
   this.button1 = new System.Windows.Forms.Button();
   this.button2 = new System.Windows.Forms.Button();
   this.groupBox1 = new System.Windows.Forms.GroupBox();
   this.button9 = new System.Windows.Forms.Button();
   this.button8 = new System.Windows.Forms.Button();
   this.button7 = new System.Windows.Forms.Button();
   this.button6 = new System.Windows.Forms.Button();
   this.button5 = new System.Windows.Forms.Button();
   this.button4 = new System.Windows.Forms.Button();
   this.button3 = new System.Windows.Forms.Button();
   this.textBox18 = new System.Windows.Forms.TextBox();
   this.textBox17 = new System.Windows.Forms.TextBox();
   this.textBox15 = new System.Windows.Forms.TextBox();
   this.textBox14 = new System.Windows.Forms.TextBox();
   this.label22 = new System.Windows.Forms.Label();
   this.label21 = new System.Windows.Forms.Label();
   this.label20 = new System.Windows.Forms.Label();
   this.label19 = new System.Windows.Forms.Label();
   this.label18 = new System.Windows.Forms.Label();
   this.label17 = new System.Windows.Forms.Label();
   this.label16 = new System.Windows.Forms.Label();
   this.label15 = new System.Windows.Forms.Label();
   this.label14 = new System.Windows.Forms.Label();
   this.label13 = new System.Windows.Forms.Label();
   this.label12 = new System.Windows.Forms.Label();
   this.textBox13 = new System.Windows.Forms.TextBox();
   this.textBox12 = new System.Windows.Forms.TextBox();
   this.textBox11 = new System.Windows.Forms.TextBox();
   this.textBox10 = new System.Windows.Forms.TextBox();
   this.textBox9 = new System.Windows.Forms.TextBox();
   this.textBox8 = new System.Windows.Forms.TextBox();
   this.textBox7 = new System.Windows.Forms.TextBox();
   this.label11 = new System.Windows.Forms.Label();
   this.label10 = new System.Windows.Forms.Label();
   this.label9 = new System.Windows.Forms.Label();
   this.textBox6 = new System.Windows.Forms.TextBox();
   this.textBox5 = new System.Windows.Forms.TextBox();
   this.textBox4 = new System.Windows.Forms.TextBox();
   this.textBox3 = new System.Windows.Forms.TextBox();
   this.textBox2 = new System.Windows.Forms.TextBox();
   this.textBox1 = new System.Windows.Forms.TextBox();
   this.label8 = new System.Windows.Forms.Label();
   this.label7 = new System.Windows.Forms.Label();
   this.label6 = new System.Windows.Forms.Label();
   this.label5 = new System.Windows.Forms.Label();
   this.label4 = new System.Windows.Forms.Label();
   this.label3 = new System.Windows.Forms.Label();
   this.label2 = new System.Windows.Forms.Label();
   this.label1 = new System.Windows.Forms.Label();
   this.groupBox2 = new System.Windows.Forms.GroupBox();
   this.checkBox8 = new System.Windows.Forms.CheckBox();
   this.checkBox7 = new System.Windows.Forms.CheckBox();
   this.checkBox6 = new System.Windows.Forms.CheckBox();
   this.checkBox5 = new System.Windows.Forms.CheckBox();
   this.button23 = new System.Windows.Forms.Button();
   this.button22 = new System.Windows.Forms.Button();
   this.textBox38 = new System.Windows.Forms.TextBox();
   this.textBox37 = new System.Windows.Forms.TextBox();
   this.textBox36 = new System.Windows.Forms.TextBox();
   this.textBox35 = new System.Windows.Forms.TextBox();
   this.textBox34 = new System.Windows.Forms.TextBox();
   this.textBox33 = new System.Windows.Forms.TextBox();
   this.textBox32 = new System.Windows.Forms.TextBox();
   this.textBox31 = new System.Windows.Forms.TextBox();
   this.textBox30 = new System.Windows.Forms.TextBox();
   this.textBox29 = new System.Windows.Forms.TextBox();
   this.label40 = new System.Windows.Forms.Label();
   this.label39 = new System.Windows.Forms.Label();
   this.label38 = new System.Windows.Forms.Label();
   this.label37 = new System.Windows.Forms.Label();
   this.label36 = new System.Windows.Forms.Label();
   this.label35 = new System.Windows.Forms.Label();
   this.listView1 = new System.Windows.Forms.ListView();
   this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
   this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
   this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
   this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
   this.columnHeader5 = new System.Windows.Forms.ColumnHeader();
   this.columnHeader6 = new System.Windows.Forms.ColumnHeader();
   this.columnHeader7 = new System.Windows.Forms.ColumnHeader();
   this.button21 = new System.Windows.Forms.Button();
   this.label34 = new System.Windows.Forms.Label();
   this.button20 = new System.Windows.Forms.Button();
   this.textBox28 = new System.Windows.Forms.TextBox();
   this.textBox27 = new System.Windows.Forms.TextBox();
   this.button19 = new System.Windows.Forms.Button();
   this.button18 = new System.Windows.Forms.Button();
   this.textBox26 = new System.Windows.Forms.TextBox();
   this.label33 = new System.Windows.Forms.Label();
   this.comboBox2 = new System.Windows.Forms.ComboBox();
   this.label32 = new System.Windows.Forms.Label();
   this.button17 = new System.Windows.Forms.Button();
   this.button16 = new System.Windows.Forms.Button();
   this.button15 = new System.Windows.Forms.Button();
   this.textBox25 = new System.Windows.Forms.TextBox();
   this.label31 = new System.Windows.Forms.Label();
   this.button14 = new System.Windows.Forms.Button();
   this.button13 = new System.Windows.Forms.Button();
   this.label30 = new System.Windows.Forms.Label();
   this.textBox24 = new System.Windows.Forms.TextBox();
   this.textBox23 = new System.Windows.Forms.TextBox();
   this.label29 = new System.Windows.Forms.Label();
   this.textBox22 = new System.Windows.Forms.TextBox();
   this.label28 = new System.Windows.Forms.Label();
   this.textBox21 = new System.Windows.Forms.TextBox();
   this.label27 = new System.Windows.Forms.Label();
   this.textBox20 = new System.Windows.Forms.TextBox();
   this.checkBox4 = new System.Windows.Forms.CheckBox();
   this.checkBox3 = new System.Windows.Forms.CheckBox();
   this.checkBox2 = new System.Windows.Forms.CheckBox();
   this.checkBox1 = new System.Windows.Forms.CheckBox();
   this.button12 = new System.Windows.Forms.Button();
   this.button11 = new System.Windows.Forms.Button();
   this.comboBox1 = new System.Windows.Forms.ComboBox();
   this.textBox19 = new System.Windows.Forms.TextBox();
   this.textBox16 = new System.Windows.Forms.TextBox();
   this.button10 = new System.Windows.Forms.Button();
   this.label26 = new System.Windows.Forms.Label();
   this.label25 = new System.Windows.Forms.Label();
   this.label24 = new System.Windows.Forms.Label();
   this.label23 = new System.Windows.Forms.Label();
   this.axPOS011 = new AxPOS01Lib.AxPOS01();
   this.groupBox1.SuspendLayout();
   this.groupBox2.SuspendLayout();
   ((System.ComponentModel.ISupportInitialize)(this.axPOS011)).BeginInit();
   this.SuspendLayout();
   //
   // button1
   //
   this.button1.Location = new System.Drawing.Point(48, 160);
   this.button1.Name = "button1";
   this.button1.Size = new System.Drawing.Size(104, 32);
   this.button1.TabIndex = 1;
   this.button1.Text = "POSPcbBeep";
   this.button1.Click += new System.EventHandler(this.button1_Click);
   //
   // button2
   //
   this.button2.Location = new System.Drawing.Point(184, 160);
   this.button2.Name = "button2";
   this.button2.Size = new System.Drawing.Size(112, 32);
   this.button2.TabIndex = 2;
   this.button2.Text = "POSCardRead";
   this.button2.Click += new System.EventHandler(this.button2_Click);
   //
   // groupBox1
   //
   this.groupBox1.Controls.Add(this.button9);
   this.groupBox1.Controls.Add(this.button8);
   this.groupBox1.Controls.Add(this.button7);
   this.groupBox1.Controls.Add(this.button6);
   this.groupBox1.Controls.Add(this.button5);
   this.groupBox1.Controls.Add(this.button4);
   this.groupBox1.Controls.Add(this.button3);
   this.groupBox1.Controls.Add(this.textBox18);
   this.groupBox1.Controls.Add(this.textBox17);
   this.groupBox1.Controls.Add(this.textBox15);
   this.groupBox1.Controls.Add(this.textBox14);
   this.groupBox1.Controls.Add(this.label22);
   this.groupBox1.Controls.Add(this.label21);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值