How to use KeyPressEvent in correct way

前端 未结 2 1370
情话喂你
情话喂你 2021-01-20 07:33

try to create HotKeys for my forms

code

    private void FormMain_KeyPress(object sender, KeyPressEventArgs e)        
    {
        if (e.KeyChar ==         


        
2条回答
  •  情深已故
    2021-01-20 07:52

    try this for combination of Ctrl + N,

    if (e.Modifiers == Keys.Control && e.KeyCode == Keys.N)
       {
          MessageBox.Show("e");
       }
    

提交回复
热议问题