1

I have a text box which is read only. I also have a tool strip menu item which has a short cut of Ctrl + R. When the focus is in the textbox the toolstrip menuitem shortcut no longer works.

I can intersect the key down event and check if the key was Ctrl + R, but since I am using a generic text box control, this would take raising an event or passing a delegate to call given specific keys to my generic control.

Does anyone have any experience getting a toolstip menuitem's shortcut to fire if the focus is on a read only control?

Drew
  • 421
  • 8
  • 16

1 Answers1

0
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) 
{
  if (keyData == (Keys.Control | Keys.R)) 
  {
      MessageBox.Show("Handle with care! :)");
  }

  return base.ProcessCmdKey(ref msg, keyData);
}

Put that logic on the form that contains the read-only control.

Mike
  • 26
  • 1
  • 3