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

📄 settings.cs

📁 常见的串口通信程序
💻 CS
📖 第 1 页 / 共 2 页
字号:
            this.ChkEvent.Text = "\u4e8b\u4ef6\u89e6\u53d1\u63a5\u6536\u6a21\u5f0f";
            this.toolTip.SetToolTip(this.ChkEvent, "If true, each char received is handled immediately. If false, the receiver must be polled for available data.");
            this.ChkEvent.CheckedChanged += new EventHandler(this.ChangeHandler);
            this.label13.Location = new Point(0x30, 0x98);
            this.label13.Name = "label13";
            this.label13.Size = new Size(0x30, 0x16);
            this.label13.TabIndex = 0x23;
            this.label13.Text = "Event";
            this.label13.TextAlign = ContentAlignment.MiddleRight;
            this.EventBox.Location = new Point(0x68, 0x98);
            this.EventBox.Name = "EventBox";
            this.EventBox.Size = new Size(0x40, 20);
            this.EventBox.TabIndex = 0x22;
            this.toolTip.SetToolTip(this.EventBox, "Event signaling char.");
            this.EventBox.SelectedIndexChanged += new EventHandler(this.ChangeHandler);
            this.label12.Location = new Point(0x30, 120);
            this.label12.Name = "label12";
            this.label12.Size = new Size(0x30, 0x16);
            this.label12.TabIndex = 0x21;
            this.label12.Text = "EOF";
            this.label12.TextAlign = ContentAlignment.MiddleRight;
            this.EofBox.Location = new Point(0x68, 120);
            this.EofBox.Name = "EofBox";
            this.EofBox.Size = new Size(0x40, 20);
            this.EofBox.TabIndex = 0x20;
            this.toolTip.SetToolTip(this.EofBox, "End of file (data) char.");
            this.EofBox.SelectedIndexChanged += new EventHandler(this.ChangeHandler);
            this.label11.Location = new Point(0x30, 0x58);
            this.label11.Name = "label11";
            this.label11.Size = new Size(0x30, 0x16);
            this.label11.TabIndex = 0x1f;
            this.label11.Text = "XOFF";
            this.label11.TextAlign = ContentAlignment.MiddleRight;
            this.XoffBox.Location = new Point(0x68, 0x58);
            this.XoffBox.Name = "XoffBox";
            this.XoffBox.Size = new Size(0x40, 20);
            this.XoffBox.TabIndex = 30;
            this.toolTip.SetToolTip(this.XoffBox, "Software suspend flow char.");
            this.XoffBox.SelectedIndexChanged += new EventHandler(this.ChangeHandler);
            this.label10.Location = new Point(0x30, 0x38);
            this.label10.Name = "label10";
            this.label10.Size = new Size(0x30, 0x16);
            this.label10.TabIndex = 0x1d;
            this.label10.Text = "XON";
            this.label10.TextAlign = ContentAlignment.MiddleRight;
            this.XonBox.Location = new Point(0x68, 0x38);
            this.XonBox.Name = "XonBox";
            this.XonBox.Size = new Size(0x40, 20);
            this.XonBox.TabIndex = 0x1c;
            this.toolTip.SetToolTip(this.XonBox, "Software flow resume char.");
            this.XonBox.SelectedIndexChanged += new EventHandler(this.ChangeHandler);
            this.label6.Location = new Point(0x18, 0xd0);
            this.label6.Name = "label6";
            this.label6.Size = new Size(0x40, 0x17);
            this.label6.TabIndex = 0x1a;
            this.label6.Text = "\u63e1\u624b\u534f\u8bae";
            this.label6.TextAlign = ContentAlignment.MiddleRight;
            this.HshakeBox.Location = new Point(0x60, 0xd0);
            this.HshakeBox.Name = "HshakeBox";
            this.HshakeBox.Size = new Size(120, 20);
            this.HshakeBox.TabIndex = 0x19;
            this.toolTip.SetToolTip(this.HshakeBox, "Peer flow control mode.");
            this.HshakeBox.SelectedIndexChanged += new EventHandler(this.ChangeHandler);
            this.label5.Location = new Point(0x18, 0xa8);
            this.label5.Name = "label5";
            this.label5.Size = new Size(0x40, 0x17);
            this.label5.TabIndex = 0x18;
            this.label5.Text = "\u5947\u5076\u6821\u9a8c";
            this.label5.TextAlign = ContentAlignment.MiddleRight;
            this.ParityBox.Location = new Point(0x60, 0xa8);
            this.ParityBox.Name = "ParityBox";
            this.ParityBox.Size = new Size(120, 20);
            this.ParityBox.TabIndex = 0x17;
            this.toolTip.SetToolTip(this.ParityBox, "Receiver parity checking");
            this.ParityBox.SelectedIndexChanged += new EventHandler(this.ChangeHandler);
            this.label4.Location = new Point(0x18, 0x80);
            this.label4.Name = "label4";
            this.label4.Size = new Size(0x40, 0x17);
            this.label4.TabIndex = 0x16;
            this.label4.Text = "\u505c\u6b62\u4f4d";
            this.label4.TextAlign = ContentAlignment.MiddleRight;
            this.StopBox.Location = new Point(0x60, 0x80);
            this.StopBox.Name = "StopBox";
            this.StopBox.Size = new Size(120, 20);
            this.StopBox.TabIndex = 0x15;
            this.toolTip.SetToolTip(this.StopBox, "Number of stop bits following each char.");
            this.StopBox.SelectedIndexChanged += new EventHandler(this.ChangeHandler);
            this.label3.Location = new Point(0x18, 0x58);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0x40, 0x17);
            this.label3.TabIndex = 20;
            this.label3.Text = "\u6570\u636e\u4f4d";
            this.label3.TextAlign = ContentAlignment.MiddleRight;
            this.DataBox.Location = new Point(0x60, 0x58);
            this.DataBox.Name = "DataBox";
            this.DataBox.Size = new Size(120, 20);
            this.DataBox.TabIndex = 0x13;
            this.toolTip.SetToolTip(this.DataBox, "Number of bits/char.");
            this.DataBox.SelectedIndexChanged += new EventHandler(this.ChangeHandler);
            this.label2.Location = new Point(0x18, 0x30);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x40, 0x17);
            this.label2.TabIndex = 0x12;
            this.label2.Text = "\u6ce2\u7279\u7387";
            this.label2.TextAlign = ContentAlignment.MiddleRight;
            this.label1.Location = new Point(0x18, 7);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x40, 0x17);
            this.label1.TabIndex = 0x11;
            this.label1.Text = "COM\u7aef\u53e3";
            this.label1.TextAlign = ContentAlignment.MiddleRight;
            this.BaudBox.Location = new Point(0x60, 0x30);
            this.BaudBox.Name = "BaudBox";
            this.BaudBox.Size = new Size(120, 20);
            this.BaudBox.TabIndex = 0x10;
            this.toolTip.SetToolTip(this.BaudBox, "Serial port line speed (bits/second).");
            this.BaudBox.SelectedIndexChanged += new EventHandler(this.ChangeHandler);
            this.PortBox.Location = new Point(0x60, 7);
            this.PortBox.Name = "PortBox";
            this.PortBox.Size = new Size(120, 20);
            this.PortBox.TabIndex = 15;
            this.toolTip.SetToolTip(this.PortBox, "Serial port that settings apply to.");
            this.AutoScaleBaseSize = new Size(6, 14);
            base.ClientSize = new Size(0x1d2, 0x11f);
            base.ControlBox = false;
            base.Controls.Add(this.label6);
            base.Controls.Add(this.HshakeBox);
            base.Controls.Add(this.label5);
            base.Controls.Add(this.ParityBox);
            base.Controls.Add(this.label4);
            base.Controls.Add(this.StopBox);
            base.Controls.Add(this.label3);
            base.Controls.Add(this.DataBox);
            base.Controls.Add(this.label2);
            base.Controls.Add(this.label1);
            base.Controls.Add(this.BaudBox);
            base.Controls.Add(this.PortBox);
            base.Controls.Add(this.panel7);
            base.Controls.Add(this.CmdCancel);
            base.Controls.Add(this.CmdSave);
            base.FormBorderStyle = FormBorderStyle.FixedSingle;
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "Settings";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "\u8bbe\u7f6e Serial Port";
            this.panel7.ResumeLayout(false);
            base.ResumeLayout(false);
        }

        private void LoadChar(ComboBox cb, object obj)
        {
            this.LoadCtrl(cb, null);
            for (int num1 = 0x21; num1 < 0x7f; num1++)
            {
                cb.Items.Add((char) ((ushort) num1));
            }
            cb.SelectedIndex = this.FindMatch(cb, obj);
        }

        private void LoadCtrl(ComboBox cb, object obj)
        {
            this.EnumLoad(typeof(CtrlChar), cb, obj);
        }

        private void UpdateConfig()
        {
            this.config.BaudRate = (LineSpeed) int.Parse(this.BaudBox.Text.Substring(5));
            this.config.DataBits = (ByteSize) this.EnumFind(typeof(ByteSize), this.DataBox.Text);
            this.config.StopBits = (StopBits) this.EnumFind(typeof(StopBits), this.StopBox.Text);
            this.config.Parity = (Parity) this.EnumFind(typeof(Parity), this.ParityBox.Text);
            this.config.FlowCtrl = (Handshake) this.EnumFind(typeof(Handshake), this.HshakeBox.Text);
            this.config.ReceiveMode = this.ChkEvent.Checked;
            this.config.NullDiscard = this.ChkDiscard.Checked;
            this.config.ErrReplace = this.ChkParity.Checked;
            this.config.XonChar = (byte) Enum.Parse(typeof(CtrlChar), this.XonBox.Text);
            this.config.XoffChar = (byte) Enum.Parse(typeof(CtrlChar), this.XoffBox.Text);
            this.config.EofChar = (this.EofBox.Text.Length > 1) ? ((byte) Enum.Parse(typeof(CtrlChar), this.EofBox.Text)) : ((byte) char.Parse(this.EofBox.Text));
            this.config.EvtChar = (this.EventBox.Text.Length > 1) ? ((byte) Enum.Parse(typeof(CtrlChar), this.EventBox.Text)) : ((byte) char.Parse(this.EventBox.Text));
            this.config.ErrChar = (this.ErrorBox.Text.Length > 1) ? ((byte) Enum.Parse(typeof(CtrlChar), this.ErrorBox.Text)) : ((byte) char.Parse(this.ErrorBox.Text));
            this.config.SetFlowControl();
        }


        // Fields
        private ComboBox BaudBox;
        private bool changed;
        private CheckBox ChkDiscard;
        private CheckBox ChkEvent;
        private CheckBox ChkParity;
        private Button CmdCancel;
        private Button CmdSave;
        private IContainer components;
        private SerialCnfg config;
        private ComboBox DataBox;
        private ComboBox EofBox;
        private ComboBox ErrorBox;
        private ComboBox EventBox;
        private string fileName;
        private ComboBox HshakeBox;
        private Label label1;
        private Label label10;
        private Label label11;
        private Label label12;
        private Label label13;
        private Label label2;
        private Label label3;
        private Label label4;
        private Label label5;
        private Label label6;
        private Label label7;
        private const int MAX_PORTS = 0x20;
        private Panel panel7;
        private ComboBox ParityBox;
        private ComboBox PortBox;
        private ComboBox StopBox;
        private ToolTip toolTip;
        private ComboBox XoffBox;
        private ComboBox XonBox;
    }
}

⌨️ 快捷键说明

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