private void MessageInput_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { SendButton.PerformClick(); } }
private void SendFieldKeyDown(object sender, KeyEventArgs e) { // 엔터키 입력시 버튼과 같은 효과 if (e.KeyCode == Keys.Enter) { SendButton.PerformClick(); } }
private void requestTextBox_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 0xD) { if (requestTextBox.Text != "" && requestTextBox.Text != " ") { e.Handled = true; SendButton.PerformClick(); } } }
//AB & ABo - Event that occurs when the user tpyes in the UserMessageBox. private void UserMessageBox_KeyDown(object sender, KeyEventArgs e) { //AB - Boolean flag that indicates if the key pressed was a character of a digit. bool isCharOrDigit = char.IsLetterOrDigit((char)e.KeyCode); //AB & ABo - Pressing the enter key has same affect as pressing the send button. if (e.KeyCode == Keys.Enter) { SendButton.PerformClick(); e.Handled = true; } if (e.KeyCode == Keys.F1) { if (AIMode == false) { AIMode = true; } else { AIMode = false; } } //AB - Performs a decrease of the count when the backspace or enter key is pressed. if (e.KeyCode == Keys.Back || e.KeyCode == Keys.Delete) { //AB - Updates the count display, with the correct formatting for a 1 digit count. if (UserMessageBox.Text.Length + 1 > 1 && UserMessageBox.Text.Length + 1 <= 9) { CharCount1Label.Text = " " + Convert.ToString(UserMessageBox.Text.Length - 1); CharCount1Label.Refresh(); } //AB - Updates the count display, with the correct formatting for a 2 digit count. if (UserMessageBox.Text.Length + 1 >= 10 && UserMessageBox.Text.Length + 1 <= 99) { CharCount1Label.Text = " " + Convert.ToString(UserMessageBox.Text.Length - 1); CharCount1Label.Refresh(); } //AB - Updates the count display, with the correct formatting for a 3 digit count. if (UserMessageBox.Text.Length + 1 >= 100 && UserMessageBox.Text.Length + 1 <= 150) { CharCount1Label.Text = Convert.ToString(UserMessageBox.Text.Length - 1); CharCount1Label.Refresh(); } } //AB - Performs an increase of the count when a alphanumeric character is pressed. if (isCharOrDigit == true | e.KeyCode == Keys.Space) { //AB - Updates the count display, with the correct formatting for a 1 digit count. if (UserMessageBox.Text.Length + 1 <= 9) { CharCount1Label.Text = " " + Convert.ToString(UserMessageBox.Text.Length + 1); CharCount1Label.Refresh(); } //AB - Updates the count display, with the correct formatting for a 2 digit count. if (UserMessageBox.Text.Length + 1 >= 10 && UserMessageBox.Text.Length + 1 <= 99) { CharCount1Label.Text = " " + Convert.ToString(UserMessageBox.Text.Length + 1); CharCount1Label.Refresh(); } //AB - Updates the count display, with the correct formatting for a 3 digit count. if (UserMessageBox.Text.Length + 1 >= 100 && UserMessageBox.Text.Length + 1 <= 150) { CharCount1Label.Text = Convert.ToString(UserMessageBox.Text.Length + 1); CharCount1Label.Refresh(); } } }