I have a project in Windows form application. I want to implement dynamically shortcut keys in this application. User can change their shortcut keys as per requirement. How can I implement this dynamically shortcut keys?
Here is something that might help, I know it isn't the best way to do but I can't do any better.
string ii = "";
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Control | Keys.C) && ii == "C")
{
MessageBox.Show("Your shortcut key is: C!!");
}
return base.ProcessCmdKey(ref msg, keyData);
}
private void comboBox1_TextChanged(object sender, EventArgs e)
{
ii = comboBox1.Text;
}
Your comboBox1
is the ComboBox
That contains your shortcut key options.
That might help some, you will have to add a bunch of if statements. Hope this helps!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With