better connection controls

This commit is contained in:
nikzori
2024-11-11 10:43:58 +03:00
parent d2c4dc3ec3
commit b5dbd8fc9c
4 changed files with 451 additions and 73 deletions

247
Form1.Designer.cs generated
View File

@@ -30,6 +30,12 @@
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(App));
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.panel8 = new System.Windows.Forms.Panel();
this.CBox_DataBits = new System.Windows.Forms.ComboBox();
this.label8 = new System.Windows.Forms.Label();
this.panel7 = new System.Windows.Forms.Panel();
this.CBox_BaudRate = new System.Windows.Forms.ComboBox();
this.label7 = new System.Windows.Forms.Label();
this.ButtonConnect = new System.Windows.Forms.Button();
this.panel2 = new System.Windows.Forms.Panel();
this.UpDown_ModbusID = new System.Windows.Forms.NumericUpDown();
@@ -39,6 +45,9 @@
this.label1 = new System.Windows.Forms.Label();
this.TextBox_Log = new System.Windows.Forms.TextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.panel6 = new System.Windows.Forms.Panel();
this.UpDown_Value = new System.Windows.Forms.NumericUpDown();
this.label6 = new System.Windows.Forms.Label();
this.panel5 = new System.Windows.Forms.Panel();
this.UpDown_RegLength = new System.Windows.Forms.NumericUpDown();
this.label5 = new System.Windows.Forms.Label();
@@ -49,35 +58,112 @@
this.panel4 = new System.Windows.Forms.Panel();
this.CBox_Function = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.panel9 = new System.Windows.Forms.Panel();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label9 = new System.Windows.Forms.Label();
this.panel10 = new System.Windows.Forms.Panel();
this.CBox_StopBits = new System.Windows.Forms.ComboBox();
this.label10 = new System.Windows.Forms.Label();
this.panel11 = new System.Windows.Forms.Panel();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.label11 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.panel8.SuspendLayout();
this.panel7.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.UpDown_ModbusID)).BeginInit();
this.panel1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.panel6.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.UpDown_Value)).BeginInit();
this.panel5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.UpDown_RegLength)).BeginInit();
this.panel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.UpDown_RegAddress)).BeginInit();
this.panel4.SuspendLayout();
this.panel9.SuspendLayout();
this.panel10.SuspendLayout();
this.panel11.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.panel11);
this.groupBox1.Controls.Add(this.panel10);
this.groupBox1.Controls.Add(this.panel8);
this.groupBox1.Controls.Add(this.panel7);
this.groupBox1.Controls.Add(this.ButtonConnect);
this.groupBox1.Controls.Add(this.panel2);
this.groupBox1.Controls.Add(this.panel1);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(344, 63);
this.groupBox1.Size = new System.Drawing.Size(490, 110);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Подключение";
//
// panel8
//
this.panel8.Controls.Add(this.panel9);
this.panel8.Controls.Add(this.CBox_DataBits);
this.panel8.Controls.Add(this.label8);
this.panel8.Location = new System.Drawing.Point(162, 19);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(79, 43);
this.panel8.TabIndex = 4;
//
// CBox_DataBits
//
this.CBox_DataBits.FormattingEnabled = true;
this.CBox_DataBits.Location = new System.Drawing.Point(6, 17);
this.CBox_DataBits.Name = "CBox_DataBits";
this.CBox_DataBits.Size = new System.Drawing.Size(70, 21);
this.CBox_DataBits.TabIndex = 2;
this.CBox_DataBits.Text = "8";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(3, 0);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(73, 13);
this.label8.TabIndex = 0;
this.label8.Text = "Биты данных";
//
// panel7
//
this.panel7.Controls.Add(this.CBox_BaudRate);
this.panel7.Controls.Add(this.label7);
this.panel7.Location = new System.Drawing.Point(81, 19);
this.panel7.Name = "panel7";
this.panel7.Size = new System.Drawing.Size(75, 43);
this.panel7.TabIndex = 3;
//
// CBox_BaudRate
//
this.CBox_BaudRate.FormattingEnabled = true;
this.CBox_BaudRate.Location = new System.Drawing.Point(6, 17);
this.CBox_BaudRate.Name = "CBox_BaudRate";
this.CBox_BaudRate.Size = new System.Drawing.Size(65, 21);
this.CBox_BaudRate.TabIndex = 2;
this.CBox_BaudRate.Text = "9600";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(3, 0);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(34, 13);
this.label7.TabIndex = 0;
this.label7.Text = "Боды";
//
// ButtonConnect
//
this.ButtonConnect.Location = new System.Drawing.Point(162, 34);
this.ButtonConnect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ButtonConnect.Location = new System.Drawing.Point(195, 75);
this.ButtonConnect.Name = "ButtonConnect";
this.ButtonConnect.Size = new System.Drawing.Size(176, 23);
this.ButtonConnect.Size = new System.Drawing.Size(100, 25);
this.ButtonConnect.TabIndex = 4;
this.ButtonConnect.Text = "Подключиться";
this.ButtonConnect.UseVisualStyleBackColor = true;
@@ -87,7 +173,7 @@
//
this.panel2.Controls.Add(this.UpDown_ModbusID);
this.panel2.Controls.Add(this.label2);
this.panel2.Location = new System.Drawing.Point(81, 19);
this.panel2.Location = new System.Drawing.Point(415, 19);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(75, 43);
this.panel2.TabIndex = 2;
@@ -124,7 +210,7 @@
this.CBox_Ports.Name = "CBox_Ports";
this.CBox_Ports.Size = new System.Drawing.Size(65, 21);
this.CBox_Ports.TabIndex = 1;
this.CBox_Ports.Text = "COM 1";
this.CBox_Ports.Text = "COM1";
this.CBox_Ports.MouseClick += new System.Windows.Forms.MouseEventHandler(this.CBox_Ports_Click);
//
// label1
@@ -138,27 +224,53 @@
//
// TextBox_Log
//
this.TextBox_Log.Location = new System.Drawing.Point(12, 82);
this.TextBox_Log.Location = new System.Drawing.Point(12, 127);
this.TextBox_Log.Multiline = true;
this.TextBox_Log.Name = "TextBox_Log";
this.TextBox_Log.ReadOnly = true;
this.TextBox_Log.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.TextBox_Log.Size = new System.Drawing.Size(417, 87);
this.TextBox_Log.Size = new System.Drawing.Size(490, 118);
this.TextBox_Log.TabIndex = 1;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.panel6);
this.groupBox2.Controls.Add(this.panel5);
this.groupBox2.Controls.Add(this.Button_SendCommand);
this.groupBox2.Controls.Add(this.panel3);
this.groupBox2.Controls.Add(this.panel4);
this.groupBox2.Location = new System.Drawing.Point(12, 175);
this.groupBox2.Location = new System.Drawing.Point(12, 251);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(417, 63);
this.groupBox2.Size = new System.Drawing.Size(490, 63);
this.groupBox2.TabIndex = 5;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Команды";
//
// panel6
//
this.panel6.Controls.Add(this.UpDown_Value);
this.panel6.Controls.Add(this.label6);
this.panel6.Location = new System.Drawing.Point(337, 20);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(75, 43);
this.panel6.TabIndex = 4;
//
// UpDown_Value
//
this.UpDown_Value.Location = new System.Drawing.Point(6, 17);
this.UpDown_Value.Name = "UpDown_Value";
this.UpDown_Value.Size = new System.Drawing.Size(66, 20);
this.UpDown_Value.TabIndex = 1;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(3, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(55, 13);
this.label6.TabIndex = 0;
this.label6.Text = "Значение";
//
// panel5
//
this.panel5.Controls.Add(this.UpDown_RegLength);
@@ -186,7 +298,7 @@
//
// Button_SendCommand
//
this.Button_SendCommand.Location = new System.Drawing.Point(337, 35);
this.Button_SendCommand.Location = new System.Drawing.Point(415, 35);
this.Button_SendCommand.Name = "Button_SendCommand";
this.Button_SendCommand.Size = new System.Drawing.Size(71, 23);
this.Button_SendCommand.TabIndex = 4;
@@ -236,6 +348,7 @@
this.CBox_Function.Size = new System.Drawing.Size(147, 21);
this.CBox_Function.TabIndex = 1;
this.CBox_Function.Text = "01 - Read Coil";
this.CBox_Function.SelectedIndexChanged += new System.EventHandler(this.OnSelectedFunctionChanged);
//
// label4
//
@@ -246,11 +359,92 @@
this.label4.TabIndex = 0;
this.label4.Text = "Функция";
//
// panel9
//
this.panel9.Controls.Add(this.comboBox1);
this.panel9.Controls.Add(this.label9);
this.panel9.Location = new System.Drawing.Point(82, 0);
this.panel9.Name = "panel9";
this.panel9.Size = new System.Drawing.Size(79, 43);
this.panel9.TabIndex = 5;
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(6, 17);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(70, 21);
this.comboBox1.TabIndex = 2;
this.comboBox1.Text = "8";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(3, 0);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(73, 13);
this.label9.TabIndex = 0;
this.label9.Text = "Биты данных";
//
// panel10
//
this.panel10.Controls.Add(this.CBox_StopBits);
this.panel10.Controls.Add(this.label10);
this.panel10.Location = new System.Drawing.Point(247, 19);
this.panel10.Name = "panel10";
this.panel10.Size = new System.Drawing.Size(79, 43);
this.panel10.TabIndex = 5;
//
// CBox_StopBits
//
this.CBox_StopBits.FormattingEnabled = true;
this.CBox_StopBits.Location = new System.Drawing.Point(6, 17);
this.CBox_StopBits.Name = "CBox_StopBits";
this.CBox_StopBits.Size = new System.Drawing.Size(70, 21);
this.CBox_StopBits.TabIndex = 2;
this.CBox_StopBits.Text = "8";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(3, 0);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(59, 13);
this.label10.TabIndex = 0;
this.label10.Text = "Стоп-биты";
//
// panel11
//
this.panel11.Controls.Add(this.comboBox2);
this.panel11.Controls.Add(this.label11);
this.panel11.Location = new System.Drawing.Point(330, 19);
this.panel11.Name = "panel11";
this.panel11.Size = new System.Drawing.Size(79, 43);
this.panel11.TabIndex = 6;
//
// comboBox2
//
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Location = new System.Drawing.Point(6, 17);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(70, 21);
this.comboBox2.TabIndex = 2;
this.comboBox2.Text = "8";
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(3, 0);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(59, 13);
this.label11.TabIndex = 0;
this.label11.Text = "Стоп-биты";
//
// App
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(432, 242);
this.ClientSize = new System.Drawing.Size(514, 326);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.TextBox_Log);
this.Controls.Add(this.groupBox1);
@@ -261,12 +455,19 @@
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.App_FormClosed);
this.Load += new System.EventHandler(this.Form1_Load);
this.groupBox1.ResumeLayout(false);
this.panel8.ResumeLayout(false);
this.panel8.PerformLayout();
this.panel7.ResumeLayout(false);
this.panel7.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.UpDown_ModbusID)).EndInit();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.panel6.ResumeLayout(false);
this.panel6.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.UpDown_Value)).EndInit();
this.panel5.ResumeLayout(false);
this.panel5.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.UpDown_RegLength)).EndInit();
@@ -275,6 +476,12 @@
((System.ComponentModel.ISupportInitialize)(this.UpDown_RegAddress)).EndInit();
this.panel4.ResumeLayout(false);
this.panel4.PerformLayout();
this.panel9.ResumeLayout(false);
this.panel9.PerformLayout();
this.panel10.ResumeLayout(false);
this.panel10.PerformLayout();
this.panel11.ResumeLayout(false);
this.panel11.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -302,6 +509,24 @@
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.ComboBox CBox_Function;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Panel panel6;
private System.Windows.Forms.NumericUpDown UpDown_Value;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Panel panel7;
private System.Windows.Forms.ComboBox CBox_BaudRate;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Panel panel8;
private System.Windows.Forms.ComboBox CBox_DataBits;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Panel panel10;
private System.Windows.Forms.ComboBox CBox_StopBits;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Panel panel9;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Panel panel11;
private System.Windows.Forms.ComboBox comboBox2;
private System.Windows.Forms.Label label11;
}
}