Beispiel #1
0
        /// <summary>
        /// Raises the KeyDown event.
        /// </summary>
        /// <param name="e">A KeyEventArgs that contains the event data.</param>
        protected override void OnKeyDown(KeyEventArgs e)
        {
            // Cannot process a message for a disposed control
            if (!IsDisposed && !Disposing)
            {
                // Do we have a manager for processing key messages?
                if (ViewManager != null)
                {
                    ViewManager.KeyDown(e);
                }
            }

            // Let base class fire events
            base.OnKeyDown(e);
        }
        /// <summary>
        /// Raises the KeyDown event.
        /// </summary>
        /// <param name="e">A KeyEventArgs that contains the event data.</param>
        protected override void OnKeyDown(KeyEventArgs e)
        {
            // Cannot process a message for a disposed control
            if (!IsDisposed)
            {
                // If the user pressed the escape key
                if (e.KeyData == Keys.Escape)
                {
                    // Kill ourself
                    Dispose();
                }
                else
                {
                    // Do we have a manager for processing key messages?
                    if (ViewManager != null)
                    {
                        ViewManager.KeyDown(e);
                    }
                }
            }

            // Let base class fire events
            base.OnKeyDown(e);
        }