ACPAddIn.AutoCompleteForm.listBox1_KeyPress C# (CSharp) Метод

listBox1_KeyPress() приватный Метод

private listBox1_KeyPress ( object sender, KeyPressEventArgs e ) : void
sender object
e System.Windows.Forms.KeyPressEventArgs
Результат void
        private void listBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            // If the control key is not pressed, pass the key pressed to the Microsoft Word Document
            bool isEnterKeyPressed = (e.KeyChar == (char)Keys.Return);
            if (!controlKeyPressed && !isEnterKeyPressed)
            {
                String result = "";

                char key = e.KeyChar;

                if (char.IsLetter(key))
                {
                    result = key.ToString().ToLower();
                }
                else
                {
                    result = key.ToString();
                }

                Globals.ThisAddIn.Application.Activate();
                SendKeys.Send(result);
                this.Hide();
            }
            e.Handled = true;
        }