コード例 #1
0
ファイル: HwndHost.cs プロジェクト: z2516305651/wpf
        /// <summary>
        /// </summary>
        /// <param name="e"></param>
        protected override void OnKeyDown(KeyEventArgs e)
        {
            MSG msg;

            if (_fTrusted.Value)
            {
                msg = ComponentDispatcher.UnsecureCurrentKeyboardMessage;
            }
            else
            {
                msg = ComponentDispatcher.CurrentKeyboardMessage;
            }


            ModifierKeys modifiers = HwndKeyboardInputProvider.GetSystemModifierKeys();

            bool handled = ((IKeyboardInputSink)this).TranslateAccelerator(ref msg, modifiers);

            if (handled)
            {
                e.Handled = handled;
            }

            base.OnKeyDown(e);
        }
コード例 #2
0
        protected override void OnKeyUp(KeyEventArgs e)
        {
            MSG msg;

            if (this._fTrusted.Value)
            {
                msg = ComponentDispatcher.UnsecureCurrentKeyboardMessage;
            }
            else
            {
                msg = ComponentDispatcher.CurrentKeyboardMessage;
            }
            ModifierKeys systemModifierKeys = HwndKeyboardInputProvider.GetSystemModifierKeys();
            bool         flag = ((IKeyboardInputSink)this).TranslateAccelerator(ref msg, systemModifierKeys);

            if (flag)
            {
                e.Handled = flag;
            }
            base.OnKeyUp(e);
        }