⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.cs

📁 单片机串行通信测试板程序
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace SComm
{
	/// <summary>
	/// Test 的摘要说明。
	/// </summary>
	public class Test : System.Windows.Forms.Form
	{
		private System.Windows.Forms.TabControl tabControl1;
		private System.Windows.Forms.TabPage tabPage1;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.ComboBox stopbit;
		private System.Windows.Forms.ComboBox databit;
		private System.Windows.Forms.ComboBox parity;
		private System.Windows.Forms.ComboBox baud;
		private System.Windows.Forms.ComboBox portid;
		private System.Windows.Forms.TabPage tabPage2;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.TextBox textBox4;
		private System.Windows.Forms.TextBox textBox3;
		private System.Windows.Forms.TextBox textBox2;
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.Label label9;
		private System.Windows.Forms.Label label8;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.TabPage tabPage3;
		private System.Windows.Forms.GroupBox groupBox3;
		//用户变量
		private	short sportid;
		private string sbaud;
		private char sdatabit;
		private string sstopbit;
		private char sparity;
		private bool sinputmode;
		//用户属性
		public char Sdatabit
		{
			get{ return sdatabit;}
		}
		public char Sparity
		{
			get{ return sparity;}
		}
		public short Sportid
		{
			get {return sportid;}
		}
		public string Sbaud
		{
			get { return sbaud;}
		}
		public string Sstopbit
		{
			get { return sstopbit;}
		}
		public bool Sinputmode
		{
			get { return sinputmode;}
			set { sinputmode=value; }
		}

//		private string str;
		

		private System.Windows.Forms.Button buttonOk;
		private System.Windows.Forms.Button buttonCancel;
		private System.Windows.Forms.RadioButton radioBinary;
		private System.Windows.Forms.RadioButton radioText;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

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

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

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

		#region Windows Form Designer generated code
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.tabControl1 = new System.Windows.Forms.TabControl();
			this.tabPage1 = new System.Windows.Forms.TabPage();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			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.stopbit = new System.Windows.Forms.ComboBox();
			this.databit = new System.Windows.Forms.ComboBox();
			this.parity = new System.Windows.Forms.ComboBox();
			this.baud = new System.Windows.Forms.ComboBox();
			this.portid = new System.Windows.Forms.ComboBox();
			this.tabPage2 = new System.Windows.Forms.TabPage();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			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.label9 = new System.Windows.Forms.Label();
			this.label8 = new System.Windows.Forms.Label();
			this.label7 = new System.Windows.Forms.Label();
			this.label6 = new System.Windows.Forms.Label();
			this.tabPage3 = new System.Windows.Forms.TabPage();
			this.groupBox3 = new System.Windows.Forms.GroupBox();
			this.radioBinary = new System.Windows.Forms.RadioButton();
			this.radioText = new System.Windows.Forms.RadioButton();
			this.buttonOk = new System.Windows.Forms.Button();
			this.buttonCancel = new System.Windows.Forms.Button();
			this.tabControl1.SuspendLayout();
			this.tabPage1.SuspendLayout();
			this.groupBox1.SuspendLayout();
			this.tabPage2.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.tabPage3.SuspendLayout();
			this.groupBox3.SuspendLayout();
			this.SuspendLayout();
			// 
			// tabControl1
			// 
			this.tabControl1.Controls.AddRange(new System.Windows.Forms.Control[] {
																					  this.tabPage1,
																					  this.tabPage2,
																					  this.tabPage3});
			this.tabControl1.Location = new System.Drawing.Point(16, 10);
			this.tabControl1.Name = "tabControl1";
			this.tabControl1.SelectedIndex = 0;
			this.tabControl1.Size = new System.Drawing.Size(384, 184);
			this.tabControl1.TabIndex = 4;
			// 
			// tabPage1
			// 
			this.tabPage1.Controls.AddRange(new System.Windows.Forms.Control[] {
																				   this.groupBox1});
			this.tabPage1.Location = new System.Drawing.Point(4, 21);
			this.tabPage1.Name = "tabPage1";
			this.tabPage1.Size = new System.Drawing.Size(376, 159);
			this.tabPage1.TabIndex = 0;
			this.tabPage1.Text = "通用";
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
																					this.label5,
																					this.label4,
																					this.label3,
																					this.label2,
																					this.label1,
																					this.stopbit,
																					this.databit,
																					this.parity,
																					this.baud,
																					this.portid});
			this.groupBox1.Location = new System.Drawing.Point(8, 8);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(360, 136);
			this.groupBox1.TabIndex = 0;
			this.groupBox1.TabStop = false;
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(192, 64);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(48, 23);
			this.label5.TabIndex = 21;
			this.label5.Text = "停止位";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(16, 64);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(56, 23);
			this.label4.TabIndex = 20;
			this.label4.Text = "数据位";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(16, 104);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(56, 23);
			this.label3.TabIndex = 19;
			this.label3.Text = "校验方式";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(192, 24);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(48, 23);
			this.label2.TabIndex = 18;
			this.label2.Text = "波特率";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(16, 24);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(53, 23);
			this.label1.TabIndex = 17;
			this.label1.Text = "串口";
			// 
			// stopbit
			// 
			this.stopbit.Items.AddRange(new object[] {
														 "1",
														 "1.5",
														 "2"});
			this.stopbit.Location = new System.Drawing.Point(248, 64);
			this.stopbit.Name = "stopbit";
			this.stopbit.Size = new System.Drawing.Size(96, 20);
			this.stopbit.TabIndex = 16;
			this.stopbit.Text = "1";
			this.stopbit.SelectedIndexChanged += new System.EventHandler(this.stopbit_SelectedIndexChanged);
			// 
			// databit
			// 
			this.databit.Items.AddRange(new object[] {
														 "8",
														 "7",
														 "6"});
			this.databit.Location = new System.Drawing.Point(80, 64);
			this.databit.Name = "databit";
			this.databit.Size = new System.Drawing.Size(96, 20);
			this.databit.TabIndex = 15;
			this.databit.Text = "8";
			this.databit.SelectedIndexChanged += new System.EventHandler(this.databit_SelectedIndexChanged);
			// 
			// parity
			// 
			this.parity.Items.AddRange(new object[] {
														"无校验",
														"奇检验",
														"偶校验"});
			this.parity.Location = new System.Drawing.Point(80, 104);
			this.parity.Name = "parity";
			this.parity.Size = new System.Drawing.Size(96, 20);
			this.parity.TabIndex = 14;
			this.parity.Text = "无校验";
			this.parity.SelectedIndexChanged += new System.EventHandler(this.parity_SelectedIndexChanged);
			// 
			// baud
			// 
			this.baud.Items.AddRange(new object[] {
													  "19200",
													  "9600",
													  "4800",
													  "2400",
													  "1200"});
			this.baud.Location = new System.Drawing.Point(248, 24);
			this.baud.Name = "baud";
			this.baud.Size = new System.Drawing.Size(96, 20);
			this.baud.TabIndex = 13;
			this.baud.Text = "9600";
			this.baud.SelectedIndexChanged += new System.EventHandler(this.baud_SelectedIndexChanged);
			// 
			// portid
			// 
			this.portid.Items.AddRange(new object[] {
														"COM1",
														"COM2"});
			this.portid.Location = new System.Drawing.Point(80, 24);
			this.portid.Name = "portid";
			this.portid.Size = new System.Drawing.Size(96, 20);
			this.portid.TabIndex = 12;
			this.portid.Text = "COM1";
			this.portid.SelectedIndexChanged += new System.EventHandler(this.portid_SelectedIndexChanged);
			// 
			// tabPage2

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -