Exemple #1
0
    /////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Closes the form without asking to save (potentially) dirty data.
    /// </summary>
    ///
    public virtual void QuitForm()
    {
        this.ExecuteWithoutFormValidation(() =>
        {
            MdiForm.IfValidateOk(() =>
            {
                Debug.TraceLine("{0} Unloading...", TraceID);
                MdiForm.Unload();
            });
        });
    }
Exemple #2
0
        private void EH_winRed_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Handled)
            {
                return;
            }

            Window w = sender as Window;

            if (w == null)
            {
                return;
            }

            switch (e.KeyCode)
            {
            case Keys.Escape:
                winMoveable.Unload();
                drawBox.Unload();
                winRead.Unload();
                Menu.Focus();
                e.StopHandling();
                break;

            case Keys.Enter:
                textBoxSubCyan.Focus();
                e.StopHandling();
                break;

            case Keys.Left:
                if (e.Control)
                {
                    if (drawBox.Width >= 19)
                    {
                        --drawBox.Width;
                    }
                }
                else if (e.Shift)
                {
                    --drawBox.Left;
                }
                else if (winMoveable.Left > 1)
                {
                    --drawBox.Left;
                    --winMoveable.Left;
                }
                e.StopHandling();
                break;

            case Keys.Right:
                if (e.Control)
                {
                    ++drawBox.Width;
                }
                else if (e.Shift)
                {
                    ++drawBox.Left;
                }
                else if (winMoveable.Left < winMoveable.Parent.Width - winMoveable.Width - 1)
                {
                    ++drawBox.Left;
                    ++winMoveable.Left;
                }
                e.StopHandling();
                break;

            case Keys.Up:
                if (e.Control)
                {
                    if (drawBox.Height >= 14)
                    {
                        --drawBox.Height;
                    }
                }
                else if (e.Shift)
                {
                    --drawBox.Top;
                }
                else if (winMoveable.Top > 1)
                {
                    --drawBox.Top;
                    --winMoveable.Top;
                }
                e.StopHandling();
                break;

            case Keys.Down:
                if (e.Control)
                {
                    ++drawBox.Height;
                }
                else if (e.Shift)
                {
                    ++drawBox.Top;
                }
                else if (winMoveable.Top < winMoveable.Parent.Height - winMoveable.Height - 1)
                {
                    ++drawBox.Top;
                    ++winMoveable.Top;
                }
                e.StopHandling();
                break;

            default:
                if (char.IsControl(e.Character))
                {
                    winRead.Text = "Control Key " + (int)e.Character
                                   + "\r\nOrig Code " + (int)e.KeyInfo.KeyChar
                                   + "\r\nKey# " + e.KeyCode
                                   + ": " + (int)e.KeyCode;
                }
                else
                {
                    winRead.Text = "Key " + e.Character
                                   + "\r\nOur Code: " + (int)e.Character
                                   + "\r\n\r\nUse Arrows to move\r\n'movable' window";
                }
                break;
            }
        }