I want to make a button on that when pressed, the key combination Ctrl + + is pressed and another where Ctrl + - is pressed. How
You should create two private functions that perform the actual tasks. Then call these functions in your button's click and ProcessCmdKey events (note that KeyDown or PreviewKeyDown will not work properly).
private void btnIncrement_Click(object sender, System.EventArgs e)
{
Increment();
}
protected override bool ProcessCmdKey(Message msg, Keys keyData)
{
if (keyData == (Keys.Ctrl | Keys.Oemplus) {
Increment();
}
return base.ProcessCmdKey(msg, keyData);
}
private void Increment()
{
//Do what needs to be done in this case
}
Same goes for the Ctrl + - keys.