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;
}