📄 form1.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace SComm
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class FormMain : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox dataDisplay;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox characterDisplay;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label1;
// private AxMSCommLib.AxMSComm axMSComm;
private AxMSCommLib.AxMSComm axMSComm1;
private System.Windows.Forms.RadioButton dec;
private System.Windows.Forms.RadioButton hex;
private System.Windows.Forms.Button ClrScr;
private System.Windows.Forms.Button Quit;
private System.Windows.Forms.Button SendData;
private System.Windows.Forms.TextBox datasend;
private System.Windows.Forms.Button Setup;
private short portid;
private string baud;
private char databit;
private string stopbit;
private char parity;
private bool inputmode;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.PictureBox pictureBox2;
// public bool Inputmode
// {
// get inputmode;
// }
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public FormMain()
{
//
// 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()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FormMain));
this.textBox1 = new System.Windows.Forms.TextBox();
this.dataDisplay = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.characterDisplay = new System.Windows.Forms.TextBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.ClrScr = new System.Windows.Forms.Button();
this.Quit = new System.Windows.Forms.Button();
this.textBox3 = new System.Windows.Forms.TextBox();
this.SendData = new System.Windows.Forms.Button();
this.datasend = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.hex = new System.Windows.Forms.RadioButton();
this.dec = new System.Windows.Forms.RadioButton();
this.Setup = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.axMSComm1 = new AxMSCommLib.AxMSComm();
this.button1 = new System.Windows.Forms.Button();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.axMSComm1)).BeginInit();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.BackColor = System.Drawing.Color.LightSteelBlue;
this.textBox1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.textBox1.ForeColor = System.Drawing.SystemColors.InfoText;
this.textBox1.Location = new System.Drawing.Point(32, 8);
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(344, 21);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F";
//
// dataDisplay
//
this.dataDisplay.Font = new System.Drawing.Font("黑体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.dataDisplay.ForeColor = System.Drawing.Color.Crimson;
this.dataDisplay.Location = new System.Drawing.Point(32, 32);
this.dataDisplay.Multiline = true;
this.dataDisplay.Name = "dataDisplay";
this.dataDisplay.Size = new System.Drawing.Size(344, 200);
this.dataDisplay.TabIndex = 2;
this.dataDisplay.Text = "";
//
// textBox2
//
this.textBox2.BackColor = System.Drawing.Color.LightSteelBlue;
this.textBox2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.textBox2.ForeColor = System.Drawing.SystemColors.InfoText;
this.textBox2.Location = new System.Drawing.Point(8, 32);
this.textBox2.Multiline = true;
this.textBox2.Name = "textBox2";
this.textBox2.ReadOnly = true;
this.textBox2.Size = new System.Drawing.Size(24, 200);
this.textBox2.TabIndex = 2;
this.textBox2.Text = "";
//
// characterDisplay
//
this.characterDisplay.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.characterDisplay.ForeColor = System.Drawing.Color.Blue;
this.characterDisplay.Location = new System.Drawing.Point(376, 32);
this.characterDisplay.Multiline = true;
this.characterDisplay.Name = "characterDisplay";
this.characterDisplay.Size = new System.Drawing.Size(120, 200);
this.characterDisplay.TabIndex = 3;
this.characterDisplay.Text = "";
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Bitmap)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(8, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(25, 25);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBox1.TabIndex = 5;
this.pictureBox1.TabStop = false;
//
// ClrScr
//
this.ClrScr.Cursor = System.Windows.Forms.Cursors.Hand;
this.ClrScr.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.ClrScr.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.ClrScr.Image = ((System.Drawing.Bitmap)(resources.GetObject("ClrScr.Image")));
this.ClrScr.Location = new System.Drawing.Point(224, 248);
this.ClrScr.Name = "ClrScr";
this.ClrScr.Size = new System.Drawing.Size(64, 40);
this.ClrScr.TabIndex = 6;
this.ClrScr.Text = "清屏";
this.ClrScr.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
this.ClrScr.Click += new System.EventHandler(this.ClrScr_Click);
//
// Quit
//
this.Quit.Cursor = System.Windows.Forms.Cursors.Hand;
this.Quit.DialogResult = System.Windows.Forms.DialogResult.Yes;
this.Quit.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.Quit.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.Quit.Image = ((System.Drawing.Bitmap)(resources.GetObject("Quit.Image")));
this.Quit.Location = new System.Drawing.Point(408, 248);
this.Quit.Name = "Quit";
this.Quit.Size = new System.Drawing.Size(64, 40);
this.Quit.TabIndex = 8;
this.Quit.Text = "退出";
this.Quit.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
this.Quit.Click += new System.EventHandler(this.Quit_Click);
//
// textBox3
//
this.textBox3.BackColor = System.Drawing.Color.LightSteelBlue;
this.textBox3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.textBox3.Location = new System.Drawing.Point(376, 8);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(120, 21);
this.textBox3.TabIndex = 9;
this.textBox3.Text = "请先设置串口参数";
//
// SendData
//
this.SendData.Cursor = System.Windows.Forms.Cursors.Hand;
this.SendData.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.SendData.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.SendData.Image = ((System.Drawing.Bitmap)(resources.GetObject("SendData.Image")));
this.SendData.Location = new System.Drawing.Point(160, 248);
this.SendData.Name = "SendData";
this.SendData.Size = new System.Drawing.Size(64, 40);
this.SendData.TabIndex = 11;
this.SendData.Text = "发送";
this.SendData.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
this.SendData.Click += new System.EventHandler(this.SendData_Click);
//
// datasend
//
this.datasend.HideSelection = false;
this.datasend.Location = new System.Drawing.Point(8, 240);
this.datasend.Multiline = true;
this.datasend.Name = "datasend";
this.datasend.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.datasend.Size = new System.Drawing.Size(136, 56);
this.datasend.TabIndex = 12;
this.datasend.Text = "";
//
// groupBox1
//
this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.hex,
this.dec});
this.groupBox1.Location = new System.Drawing.Point(0, 296);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(144, 48);
this.groupBox1.TabIndex = 13;
this.groupBox1.TabStop = false;
//
// hex
//
this.hex.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.hex.Location = new System.Drawing.Point(72, 24);
this.hex.Name = "hex";
this.hex.Size = new System.Drawing.Size(48, 16);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -