improve interface

master
phkim 3 years ago
parent 8f91936377
commit bcdc6869cc
  1. 8
      RS232Test/Form1.Designer.cs
  2. 11
      RS232Test/Form1.cs

@ -71,13 +71,16 @@
//
// printText
//
this.printText.BackColor = System.Drawing.Color.White;
this.printText.Dock = System.Windows.Forms.DockStyle.Fill;
this.printText.Location = new System.Drawing.Point(3, 38);
this.printText.Multiline = true;
this.printText.Name = "printText";
this.printText.ReadOnly = true;
this.printText.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.printText.Size = new System.Drawing.Size(394, 366);
this.printText.TabIndex = 2;
this.printText.TabStop = false;
//
// commandText
//
@ -85,7 +88,8 @@
this.commandText.Location = new System.Drawing.Point(3, 3);
this.commandText.Name = "commandText";
this.commandText.Size = new System.Drawing.Size(288, 21);
this.commandText.TabIndex = 3;
this.commandText.TabIndex = 0;
this.commandText.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.commandText_KeyPress);
//
// Send
//
@ -93,7 +97,7 @@
this.Send.Location = new System.Drawing.Point(297, 3);
this.Send.Name = "Send";
this.Send.Size = new System.Drawing.Size(94, 23);
this.Send.TabIndex = 4;
this.Send.TabIndex = 1;
this.Send.Text = "전송";
this.Send.UseVisualStyleBackColor = true;
this.Send.Click += new System.EventHandler(this.Send_Click);

@ -211,6 +211,7 @@ TOC: {1} ppb
private void Send_Click(object sender, EventArgs e)
{
string command = commandText.Text + "\r\n";
if (!serialPort.IsOpen)
{
MessageBox.Show("포트가 열려있지 않습니다.");
@ -220,6 +221,8 @@ TOC: {1} ppb
Print(string.Format("\t[CMD] {0} {1}", DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss"), commandText.Text));
serialPort.Write(command);
commandText.Clear();
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
@ -228,6 +231,14 @@ TOC: {1} ppb
serialPort.Close();
}
private void commandText_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar != (char)Keys.Enter)
return;
Send_Click(sender, e);
}
}
}

Loading…
Cancel
Save