Hi,
You can create your own class
public class HotKeyData
{
public HotKeyData(string friendlyName, uint keyModifier, uint keyCode)
{
FriendlyName = friendlyName;
KeyModifier = keyModifier;
KeyCode = keyCode;
}
public string FriendlyName { get; set; }
public uint KeyModifier { get; set; }
public uint KeyCode { get; set; }
}
Then create a list with your class
private List<HotKeyData> comboList = new List<HotKeyData>();
In e.g. Form_Load you add data to the list
comboList.Add(new HotKeyData("Key1", 1, 11));
comboList.Add(new HotKeyData("Key2", 2, 12));
comboList.Add(new HotKeyData("Key3", 3, 13));
comboList.Add(new HotKeyData("Key4", 4, 14));
Then bind the list to the combobox
comboBox1.DataSource = comboList;
comboBox1.DisplayMember = "FriendlyName";
Implement one event for the combo box.
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
HotKeyData keyData = (HotKeyData)comboBox1.SelectedItem;
RegisterHotKey(_hWnd, 1, keyData.KeyModifier, keyData.KeyCode);
}
At least I think this is what you want.