在winform列表框中获取键盘输入

getting keyboard input in winform listbox

我正在修改一个程序,以便列表框选择键盘输入(数字键盘、D0-D9、字母键)并根据输入编辑当前所选列表框项的属性。我的问题是似乎没有可以将按键转换为字母的功能。例如,目前我有一个函数

        string letter;
        if (e.KeyCode == Keys.A) { letter = "a"; return letter; }
        if (e.KeyCode == Keys.B) { letter = "b"; return letter; }
        if (e.KeyCode == Keys.C) { letter = "c"; return letter; }
        if (e.KeyCode == Keys.D) { letter = "d"; return letter; }
        if (e.KeyCode == Keys.E) { letter = "e"; return letter; }
        if (e.KeyCode == Keys.F) { letter = "f"; return letter; }
        if (e.KeyCode == Keys.G) { letter = "g"; return letter; }
        if (e.KeyCode == Keys.H) { letter = "h"; return letter; }
        if (e.KeyCode == Keys.I) { letter = "i"; return letter; }
        if (e.KeyCode == Keys.J) { letter = "j"; return letter; }
        if (e.KeyCode == Keys.K) { letter = "k"; return letter; }
        if (e.KeyCode == Keys.L) { letter = "l"; return letter; }
        if (e.KeyCode == Keys.M) { letter = "m"; return letter; }
        if (e.KeyCode == Keys.N) { letter = "n"; return letter; }
        if (e.KeyCode == Keys.O) { letter = "o"; return letter; }
        if (e.KeyCode == Keys.P) { letter = "p"; return letter; }

整个字母表和数字等等,我想扩展它以包括符号。我想知道是否存在更有效的函数我可以调用它可以接受 keyeventArg 或其 keyCode / KeyValue / KeyData 并能够告诉我它是什么字母/数字,而不是为每个人输入它 letter/number/symbol.

    private void listBox1_KeyPress(object sender, KeyPressEventArgs e)
    {
        string letter = "";
        //letter = ProcessKey(e.KeyChar);
        //or
        letter = e.KeyChar.ToString();
    }

    private string ProcessKey(char key)
    {
        return key.ToString();
    }