📄 settingsform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;
using System.Xml.Serialization;
using JH.CommBase;
/// <summary>
/// Summary description for SettingsForm.
/// </summary>
public class SettingsForm : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItemSaveXML;
private System.Windows.Forms.MenuItem menuItemOpenXML;
private System.Windows.Forms.MenuItem menuItemClose;
private System.Windows.Forms.MenuItem menuItemHSN;
private System.Windows.Forms.MenuItem menuItemHSX;
private System.Windows.Forms.MenuItem menuItemHSC;
private System.Windows.Forms.MenuItem menuItemHSD;
private System.Windows.Forms.ComboBox comboBoxPort;
private System.Windows.Forms.ComboBox comboBoxBaud;
private System.ComponentModel.IContainer components;
private System.Windows.Forms.ComboBox comboBoxParity;
private System.Windows.Forms.ComboBox comboBoxDB;
private System.Windows.Forms.ComboBox comboBoxSB;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.CheckBox checkBoxCTS;
private System.Windows.Forms.CheckBox checkBoxDSR;
private System.Windows.Forms.CheckBox checkBoxTxX;
private System.Windows.Forms.CheckBox checkBoxXC;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.ComboBox comboBoxRTS;
private System.Windows.Forms.ComboBox comboBoxDTR;
private System.Windows.Forms.CheckBox checkBoxRxX;
private System.Windows.Forms.CheckBox checkBoxGD;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.NumericUpDown numericUpDownLW;
private System.Windows.Forms.NumericUpDown numericUpDownHW;
private System.Windows.Forms.NumericUpDown numericUpDownRxS;
private System.Windows.Forms.NumericUpDown numericUpDownTxS;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.NumericUpDown numericUpDownTC;
private System.Windows.Forms.NumericUpDown numericUpDownTM;
private System.Windows.Forms.CheckBox checkBoxAR;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.NumericUpDown numericUpDownBRN;
private System.Windows.Forms.CheckBox checkBoxHX;
private System.Windows.Forms.ComboBox comboBoxBRK;
private System.Windows.Forms.ComboBox comboBoxXon;
private System.Windows.Forms.ComboBox comboBoxXoff;
private System.Windows.Forms.MenuItem menuItemFile;
private System.Windows.Forms.MenuItem menuItemDefault;
private System.Windows.Forms.OpenFileDialog openFileDialog;
private System.Windows.Forms.SaveFileDialog saveFileDialog;
private System.Windows.Forms.CheckBox checkBoxBLC;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.CheckBox checkBoxCheck;
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.Label label23;
private System.Windows.Forms.Label label24;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ToolTip toolTip;
public SettingsForm(BaseTerm.CommBaseTermSettings settings)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
FillASCII(comboBoxXon);
FillASCII(comboBoxXoff);
FillASCII(comboBoxBRK);
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItemFile = new System.Windows.Forms.MenuItem();
this.menuItemSaveXML = new System.Windows.Forms.MenuItem();
this.menuItemOpenXML = new System.Windows.Forms.MenuItem();
this.menuItemClose = new System.Windows.Forms.MenuItem();
this.menuItemDefault = new System.Windows.Forms.MenuItem();
this.menuItemHSN = new System.Windows.Forms.MenuItem();
this.menuItemHSX = new System.Windows.Forms.MenuItem();
this.menuItemHSC = new System.Windows.Forms.MenuItem();
this.menuItemHSD = new System.Windows.Forms.MenuItem();
this.comboBoxPort = new System.Windows.Forms.ComboBox();
this.comboBoxBaud = new System.Windows.Forms.ComboBox();
this.comboBoxParity = new System.Windows.Forms.ComboBox();
this.comboBoxDB = new System.Windows.Forms.ComboBox();
this.comboBoxSB = new System.Windows.Forms.ComboBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label21 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label();
this.label19 = new System.Windows.Forms.Label();
this.numericUpDownTC = new System.Windows.Forms.NumericUpDown();
this.numericUpDownTM = new System.Windows.Forms.NumericUpDown();
this.numericUpDownTxS = new System.Windows.Forms.NumericUpDown();
this.checkBoxCheck = new System.Windows.Forms.CheckBox();
this.checkBoxXC = new System.Windows.Forms.CheckBox();
this.checkBoxTxX = new System.Windows.Forms.CheckBox();
this.checkBoxDSR = new System.Windows.Forms.CheckBox();
this.checkBoxCTS = new System.Windows.Forms.CheckBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label24 = new System.Windows.Forms.Label();
this.label23 = new System.Windows.Forms.Label();
this.label22 = new System.Windows.Forms.Label();
this.numericUpDownRxS = new System.Windows.Forms.NumericUpDown();
this.numericUpDownHW = new System.Windows.Forms.NumericUpDown();
this.numericUpDownLW = new System.Windows.Forms.NumericUpDown();
this.checkBoxGD = new System.Windows.Forms.CheckBox();
this.checkBoxRxX = new System.Windows.Forms.CheckBox();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.comboBoxDTR = new System.Windows.Forms.ComboBox();
this.comboBoxRTS = new System.Windows.Forms.ComboBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.label9 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.comboBoxXoff = new System.Windows.Forms.ComboBox();
this.comboBoxXon = new System.Windows.Forms.ComboBox();
this.checkBoxAR = new System.Windows.Forms.CheckBox();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.label18 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.checkBoxBLC = new System.Windows.Forms.CheckBox();
this.comboBoxBRK = new System.Windows.Forms.ComboBox();
this.checkBoxHX = new System.Windows.Forms.CheckBox();
this.numericUpDownBRN = new System.Windows.Forms.NumericUpDown();
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownTC)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownTM)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownTxS)).BeginInit();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownRxS)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownHW)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownLW)).BeginInit();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownBRN)).BeginInit();
this.SuspendLayout();
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItemFile,
this.menuItemDefault});
//
// menuItemFile
//
this.menuItemFile.Index = 0;
this.menuItemFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItemSaveXML,
this.menuItemOpenXML,
this.menuItemClose});
this.menuItemFile.Text = "&File";
//
// menuItemSaveXML
//
this.menuItemSaveXML.Index = 0;
this.menuItemSaveXML.Text = "&Save as XML";
this.menuItemSaveXML.Click += new System.EventHandler(this.menuItemSaveXML_Click);
//
// menuItemOpenXML
//
this.menuItemOpenXML.Index = 1;
this.menuItemOpenXML.Text = "&Load from XML";
this.menuItemOpenXML.Click += new System.EventHandler(this.menuItemOpenXML_Click);
//
// menuItemClose
//
this.menuItemClose.Index = 2;
this.menuItemClose.Text = "&Close";
this.menuItemClose.Click += new System.EventHandler(this.menuItemClose_Click);
//
// menuItemDefault
//
this.menuItemDefault.Index = 1;
this.menuItemDefault.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItemHSN,
this.menuItemHSX,
this.menuItemHSC,
this.menuItemHSD});
this.menuItemDefault.Text = "&Defaults";
//
// menuItemHSN
//
this.menuItemHSN.Index = 0;
this.menuItemHSN.Text = "&No handshaking";
this.menuItemHSN.Click += new System.EventHandler(this.menuItemHSN_Click);
//
// menuItemHSX
//
this.menuItemHSX.Index = 1;
this.menuItemHSX.Text = "&Xon / Xoff";
this.menuItemHSX.Click += new System.EventHandler(this.menuItemHSX_Click);
//
// menuItemHSC
//
this.menuItemHSC.Index = 2;
this.menuItemHSC.Text = "&CTS / RTS";
this.menuItemHSC.Click += new System.EventHandler(this.menuItemHSC_Click);
//
// menuItemHSD
//
this.menuItemHSD.Index = 3;
this.menuItemHSD.Text = "&DSR / DTR";
this.menuItemHSD.Click += new System.EventHandler(this.menuItemHSD_Click);
//
// comboBoxPort
//
this.comboBoxPort.Location = new System.Drawing.Point(80, 16);
this.comboBoxPort.Name = "comboBoxPort";
this.comboBoxPort.Size = new System.Drawing.Size(64, 21);
this.comboBoxPort.TabIndex = 0;
this.toolTip.SetToolTip(this.comboBoxPort, "Communications port name (\"COM1\")");
this.comboBoxPort.DropDown += new System.EventHandler(this.comboBoxPort_DropDown);
//
// comboBoxBaud
//
this.comboBoxBaud.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxBaud.Items.AddRange(new object[] {
"75",
"110",
"134",
"150",
"300",
"600",
"1200",
"1800",
"2400",
"4800",
"7200",
"9600",
"14400",
"19200",
"38400",
"57600",
"115200",
"128000"});
this.comboBoxBaud.Location = new System.Drawing.Point(216, 16);
this.comboBoxBaud.Name = "comboBoxBaud";
this.comboBoxBaud.Size = new System.Drawing.Size(64, 21);
this.comboBoxBaud.TabIndex = 2;
this.toolTip.SetToolTip(this.comboBoxBaud, "Baud rate (unsupported rates will throw an exception)");
//
// comboBoxParity
//
this.comboBoxParity.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxParity.Items.AddRange(new object[] {
"none",
"odd",
"even",
"mark",
"space"});
this.comboBoxParity.Location = new System.Drawing.Point(112, 56);
this.comboBoxParity.Name = "comboBoxParity";
this.comboBoxParity.Size = new System.Drawing.Size(64, 21);
this.comboBoxParity.TabIndex = 4;
this.toolTip.SetToolTip(this.comboBoxParity, "Parity scheme (except for [none] adds a bit to the frame)");
//
// comboBoxDB
//
this.comboBoxDB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxDB.Items.AddRange(new object[] {
"4",
"5",
"6",
"7",
"8"});
this.comboBoxDB.Location = new System.Drawing.Point(8, 56);
this.comboBoxDB.Name = "comboBoxDB";
this.comboBoxDB.Size = new System.Drawing.Size(64, 21);
this.comboBoxDB.TabIndex = 6;
this.toolTip.SetToolTip(this.comboBoxDB, "Number of data bits in the frame (unsupported values will throw an exception)");
//
// comboBoxSB
//
this.comboBoxSB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxSB.Items.AddRange(new object[] {
"1",
"1.5",
"2"});
this.comboBoxSB.Location = new System.Drawing.Point(216, 56);
this.comboBoxSB.Name = "comboBoxSB";
this.comboBoxSB.Size = new System.Drawing.Size(64, 21);
this.comboBoxSB.TabIndex = 8;
this.toolTip.SetToolTip(this.comboBoxSB, "Number of stop bits added to the frame");
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label21);
this.groupBox1.Controls.Add(this.label20);
this.groupBox1.Controls.Add(this.label19);
this.groupBox1.Controls.Add(this.numericUpDownTC);
this.groupBox1.Controls.Add(this.numericUpDownTM);
this.groupBox1.Controls.Add(this.numericUpDownTxS);
this.groupBox1.Controls.Add(this.checkBoxCheck);
this.groupBox1.Controls.Add(this.checkBoxXC);
this.groupBox1.Controls.Add(this.checkBoxTxX);
this.groupBox1.Controls.Add(this.checkBoxDSR);
this.groupBox1.Controls.Add(this.checkBoxCTS);
this.groupBox1.Location = new System.Drawing.Point(4, 88);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(144, 216);
this.groupBox1.TabIndex = 10;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Tx Flow Control";
//
// label21
//
this.label21.Location = new System.Drawing.Point(8, 161);
this.label21.Name = "label21";
this.label21.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.label21.Size = new System.Drawing.Size(56, 16);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -