📄 test.cs
字号:
//
this.tabPage2.Controls.AddRange(new System.Windows.Forms.Control[] {
this.groupBox2});
this.tabPage2.Location = new System.Drawing.Point(4, 21);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(376, 159);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "缓存";
this.tabPage2.Visible = false;
//
// groupBox2
//
this.groupBox2.Controls.AddRange(new System.Windows.Forms.Control[] {
this.textBox4,
this.textBox3,
this.textBox2,
this.textBox1,
this.label9,
this.label8,
this.label7,
this.label6});
this.groupBox2.Location = new System.Drawing.Point(8, 8);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(344, 128);
this.groupBox2.TabIndex = 0;
this.groupBox2.TabStop = false;
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(112, 40);
this.textBox4.Name = "textBox4";
this.textBox4.ReadOnly = true;
this.textBox4.Size = new System.Drawing.Size(64, 21);
this.textBox4.TabIndex = 7;
this.textBox4.Text = "1024";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(112, 88);
this.textBox3.Name = "textBox3";
this.textBox3.ReadOnly = true;
this.textBox3.Size = new System.Drawing.Size(64, 21);
this.textBox3.TabIndex = 6;
this.textBox3.Text = "1024";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(272, 88);
this.textBox2.Name = "textBox2";
this.textBox2.ReadOnly = true;
this.textBox2.Size = new System.Drawing.Size(32, 21);
this.textBox2.TabIndex = 5;
this.textBox2.Text = "0";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(272, 40);
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(32, 21);
this.textBox1.TabIndex = 4;
this.textBox1.Text = "1";
//
// label9
//
this.label9.Location = new System.Drawing.Point(224, 40);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(40, 23);
this.label9.TabIndex = 3;
this.label9.Text = "R阀值";
//
// label8
//
this.label8.Location = new System.Drawing.Point(224, 88);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(40, 23);
this.label8.TabIndex = 2;
this.label8.Text = "S阀值";
//
// label7
//
this.label7.Location = new System.Drawing.Point(8, 88);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(96, 23);
this.label7.TabIndex = 1;
this.label7.Text = "输入缓冲区大小";
//
// label6
//
this.label6.Location = new System.Drawing.Point(8, 40);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(96, 23);
this.label6.TabIndex = 0;
this.label6.Text = "输入缓冲区大小";
//
// tabPage3
//
this.tabPage3.Controls.AddRange(new System.Windows.Forms.Control[] {
this.groupBox3});
this.tabPage3.Location = new System.Drawing.Point(4, 21);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(376, 159);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "通信方式";
this.tabPage3.Visible = false;
//
// groupBox3
//
this.groupBox3.Controls.AddRange(new System.Windows.Forms.Control[] {
this.radioBinary,
this.radioText});
this.groupBox3.Location = new System.Drawing.Point(24, 24);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(176, 80);
this.groupBox3.TabIndex = 0;
this.groupBox3.TabStop = false;
//
// radioBinary
//
this.radioBinary.Location = new System.Drawing.Point(24, 48);
this.radioBinary.Name = "radioBinary";
this.radioBinary.TabIndex = 2;
this.radioBinary.Text = "二进制方式";
this.radioBinary.Click += new System.EventHandler(this.radioBinary_Click);
//
// radioText
//
this.radioText.Location = new System.Drawing.Point(24, 16);
this.radioText.Name = "radioText";
this.radioText.TabIndex = 1;
this.radioText.Text = "字符方式";
this.radioText.Click += new System.EventHandler(this.radioText_Click);
//
// buttonOk
//
this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.OK;
this.buttonOk.Location = new System.Drawing.Point(176, 200);
this.buttonOk.Name = "buttonOk";
this.buttonOk.TabIndex = 5;
this.buttonOk.Text = "确定";
this.buttonOk.Click += new System.EventHandler(this.buttonOk_Click);
//
// buttonCancel
//
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(288, 200);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.TabIndex = 6;
this.buttonCancel.Text = "取消";
//
// Test
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(408, 229);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.buttonCancel,
this.buttonOk,
this.tabControl1});
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Name = "Test";
this.ShowInTaskbar = false;
this.Text = "Test";
this.Load += new System.EventHandler(this.Test_Load);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void Test_Load(object sender, System.EventArgs e)
{
sportid =1;
sbaud = "9600";
sparity ='n';
sdatabit ='8';
sstopbit ="1";
if(!this.sinputmode)
{
this.radioText.Checked=true;
this.radioBinary.Checked=false;
}
else
{
this.radioBinary.Checked=true;
this.radioText.Checked=false;
}
}
private void portid_SelectedIndexChanged(object sender, System.EventArgs e)
{
switch(portid.SelectedIndex)
{
case 0:
sportid=1;
break;
case 1:
sportid=2;
break;
default:
sportid=1;
break;
}
}
private void baud_SelectedIndexChanged(object sender, System.EventArgs e)
{
switch(baud.SelectedIndex)
{
case 0:
sbaud="19200";
break;
case 1:
sbaud="9600";
break;
case 2:
sbaud="4800";
break;
case 3:
sbaud="2400";
break;
case 4:
sbaud="1200";
break;
default:
sbaud="9600";
break;
}
}
private void databit_SelectedIndexChanged(object sender, System.EventArgs e)
{
switch(databit.SelectedIndex)
{
case 0:
sdatabit = '8';
break;
case 1:
sdatabit = '7';
break;
case 2:
sdatabit = '6';
break;
default:
sdatabit = '8';
break;
}
}
private void stopbit_SelectedIndexChanged(object sender, System.EventArgs e)
{
switch(stopbit.SelectedIndex)
{
case 0:
sstopbit = "1";
break;
case 1:
sstopbit = "1.5";
break;
case 2:
sstopbit = "2";
break;
default:
sstopbit = "1";
break;
}
}
private void parity_SelectedIndexChanged(object sender, System.EventArgs e)
{
switch(parity.SelectedIndex)
{
default:
sparity ='n';
break;
}
}
private void buttonOk_Click(object sender, System.EventArgs e)
{
// FormMain formmain=new FormMain();
// formmain.setComm(sportid,sbaud,sdatabit,sstopbit,sparity);
}
private void radioText_Click(object sender, System.EventArgs e)
{
sinputmode=false;
}
private void radioBinary_Click(object sender, System.EventArgs e)
{
sinputmode=true;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -