Tuesday, April 15, 2014

Check Multiple Key at a time in C#

I have an TextBox where I need Control Key and Plus / Minus Key to Change the Font Size. So I did the following steps for this.


            if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
            {
                if (Keyboard.IsKeyDown(Key.OemMinus))
                    SmallSize_Click(null, null);
                else if (Keyboard.IsKeyDown(Key.OemPlus))
                    BigSize_Click(null, null);
            }

No comments:

Post a Comment