How to change dynamic keys in a form application?

I have a project in a windows form application. I want to use dynamic keyboard shortcuts in this application. The user can change their keyboard shortcuts as required. How can I implement these dynamic keyboard shortcuts?

+4
source share
1 answer

Here is something that can help, I know that this is not the best way to do, but I can not do 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 keyboard shortcuts.

This may help some, you have to add a bunch of if statements. Hope this helps!

+2
source

Source: https://habr.com/ru/post/1493052/


All Articles