/* KeyDownイベント */ void Test_KeyDown(object sender, KeyEventArgs e) { //入力キー分岐 switch (e.KeyCode) { case Keys.D0: tcp = new TCPWindow(); tcp.Show(); break; case Keys.D1: Form1.ctrl_box.SendData = ControlWindow.srialData1; break; case Keys.D2: Form1.ctrl_box.SendData = ControlWindow.srialData2; break; case Keys.D3: Form1.ctrl_box.SendData = ControlWindow.srialData3; break; case Keys.Enter: Form1.ctrl_box.SendData = "OK"; break; case Keys.Escape: this.Close(); break; } }
/* TCPウィンドウ表示用(二重起動防止) */ private void show_tcp() { if (this.tcp == null || this.tcp.IsDisposed) { this.tcp = new TCPWindow(); } if (this.tcp.Visible != true) { tcp.Owner = this; this.tcp.Show(); } else { this.cmd.Activate(); } }