#626 – Key Up/Down Sequence When Using CTRL Key

When you use the Ctrl-key in combination with another key, e.g. pressing Ctrl-G, the control that has focus will receive KeyUp and KeyDown events for both the Ctrl key and the main key that you are pressing.

For example, if a TextBox control has focus and I press Ctrl-G (which doesn’t normally do anything in a TextBox) and I use the Ctrl key on the left side of the keyboard, I’ll see the following events for the TextBox, in the sequence listed.

  • PreviewKeyDown, key = LeftCtrl
  • KeyDown, key = LeftCtrl
  • PreviewKeyDown, key = G
  • KeyDown, key = G
  • PreviewKeyUp, key = G
  • KeyUp, key = G
  • PreviewKeyUp, key = LeftCtrl
  • KeyUp, key = LeftCtrl

In this case, you can see that my sequence in pressing/releasing the keys was:

  • Press and hold left Ctrl key
  • Press G key
  • Release G key
  • Release Ctrl key

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: