Ejemplo n.º 1
0
    /////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Initializes Window menu item in the main menu.
    /// </summary>
    ///
    private void InitializeMenu_Window()
    {
        Menu parent = this.Menu;

        //-------------------------------------------------------------------------------
        MenuItem miWindow = new MenuItem("&Window");

        SetToolTip(miWindow, "Arrange windows...");

        parent.MenuItems.Add(miWindow);

        //-------------------------------------------------------------------------------
        MenuItem miCascade = new MenuItem("&Cascade Windows");

        SetToolTip(miCascade, "Cascade...");

        miWindow.MenuItems.Add(miCascade);

        miCascade.Click += delegate
        {
            LayoutMdi(MdiLayout.Cascade);
            if (ActiveMdiChild != null)
            {
                ActiveMdiChild.Focus();
            }
        };

        //-------------------------------------------------------------------------------
        MenuItem miCloseAll = new MenuItem("Clean &Desktop");

        SetToolTip(miCloseAll, "Close all open forms...");

        miWindow.MenuItems.Add(miCloseAll);

        miCloseAll.Click += delegate
        {
            UnloadAllMdiChildForms();
        };

#if TEXTUI
        //-------------------------------------------------------------------------------
        MenuItem miRefresh = new MenuItem("&Refresh Screen")
        {
            Shortcut = Shortcut.CtrlL
        };
        SetToolTip(miRefresh, "Refresh (full repaint) screen...");

        miWindow.MenuItems.Add(miRefresh);

        miRefresh.Click += delegate
        {
            Application.Screen.FullRepaint();
        };
#else
        //-------------------------------------------------------------------------------
        MenuItem miSnapshot = new MenuItem("Sna&pshot to file...")
        {
            Shortcut = Shortcut.CtrlP
        };
        SetToolTip(miSnapshot, "Snapshot current MDI window to PNG file...");

        miWindow.MenuItems.Add(miSnapshot);

        miSnapshot.Click += delegate
        {
            SnapshotAsPngImage(ActiveMdiChild == null ? this : ActiveMdiChild);
        };

        //-------------------------------------------------------------------------------
        miWindow.MdiList = true;

        miWindow.Popup += delegate
        {
            miCascade.Enabled  = MdiChildren.Length > 1;
            miCloseAll.Enabled = MdiChildren.Length > 0;
        };
#endif
    }