[C#] winform 단축키(핫키) 설정

[C#] winform 단축키(핫키) 설정

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
    Keys key = keyData & ~(Keys.Shift | Keys.Control);
 
    switch (key)
    {
        case Keys.F:
            if ((keyData & Keys.Control) != 0)
            {
                MessageBox.Show("Ctrl+F");
                return true;
            }
            break;
        case Keys.F5:
            MessageBox.Show("f5");
            return true;
            break;
    }
    return base.ProcessCmdKey(ref msg, keyData); 
 
}