private void SetText(string text) { if (this.RxTx_box.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetText); this.Invoke(d, new object[] { text }); } else { if (text == "\b") { try { if (this.RxTx_box.Text[this.RxTx_box.Text.Length - 1] == 13) { this.RxTx_box.Text = this.RxTx_box.Text.Remove(this.RxTx_box.Text.Length - 1, 1); } this.RxTx_box.Text = this.RxTx_box.Text.Remove(this.RxTx_box.Text.Length - 1, 1); this.RxTx_box.SelectionStart = this.RxTx_box.Text.Length; RxTx_box.ScrollToCaret(); } catch (System.Exception) { } } else { this.RxTx_box.Text += text; this.RxTx_box.SelectionStart = this.RxTx_box.Text.Length; RxTx_box.ScrollToCaret(); } } }
public void mainForm_keyDown(object sender, KeyEventArgs e) { if (e.Alt && e.KeyCode == Keys.C) { e.SuppressKeyPress = true; RxTx_box.Clear(); } if (e.KeyCode == Keys.E && e.Control) { e.SuppressKeyPress = true; Encryption.Checked = !Encryption.Checked; } if (e.KeyCode == Keys.Escape || e.Control) { e.SuppressKeyPress = true; } }
private void Clear_Click(object sender, EventArgs e) { RxTx_box.Clear(); }