⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sampledocking.cs

📁 Magic Library 1.7,有说明文档
💻 CS
📖 第 1 页 / 共 3 页
字号:
    
        // Request a new Docking window be created for the above Content on the right edge
        _manager.AddContentWithState(c, State.DockRight);
    }

    protected void OnCreateC2(object sender, EventArgs e)
    {
        // Create Content which contains a RichTextBox
        Content c = _manager.Contents.Add(new DummyPanel(), "Panel " + _count++, _internalImages, _count % 6);
        
        // Setup initial state to match menu selections
        DefineContentState(c);

        // Setup the correct starting colors to match the menu selections
        DefineControlColors(c);

        // Request a new Docking window be created for the above Content on the bottom edge
        _manager.AddContentWithState(c, State.DockBottom);
    }
    
    protected void OnCreateC3(object sender, EventArgs e)
    {
        // Create Content which contains a RichTextBox
        Content c = _manager.Contents.Add(new RichTextBox(), "RichTextBox " + _count++, _internalImages, _count % 6);
        
        c.Control.Disposed += new EventHandler(OnRTBDisposed);
        
        // Setup initial state to match menu selections
        DefineContentState(c);

        // Setup the correct starting colors to match the menu selections
        DefineControlColors(c);

        // Request a new Docking window be created for the above Content on the left edge
        _manager.AddContentWithState(c, State.DockLeft);
    }

    protected void OnCreateC31(object sender, EventArgs e)
    {
        // Create three Content objects, one of each type
        Content cA = _manager.Contents.Add(new DummyForm(), "Form " + _count++, _internalImages, _count % 6);
        Content cB = _manager.Contents.Add(new DummyPanel(), "Panel " + _count++, _internalImages, _count % 6);
        Content cC = _manager.Contents.Add(new RichTextBox(), "RichTextBox " + _count++, _internalImages, _count % 6);
        
        // Setup initial state to match menu selections
        DefineContentState(cA);
        DefineContentState(cB);
        DefineContentState(cC);

        // Setup the correct starting colors to match the menu selections
        DefineControlColors(cA);
        DefineControlColors(cB);
        DefineControlColors(cC);

        // Request a new Docking window be created for the first content on the bottom edge
        WindowContent wc = _manager.AddContentWithState(cA, State.DockBottom) as WindowContent;
        
        // Add two other content into the same Zone
        _manager.AddContentToZone(cB, wc.ParentZone, 1);
        _manager.AddContentToZone(cC, wc.ParentZone, 2);
    }

    protected void OnCreateC32(object sender, EventArgs e)
    {
        // Create three Content objects, one of each type
        Content cA = _manager.Contents.Add(new DummyForm(), "Form " + _count++, _internalImages, _count % 6);
        Content cB = _manager.Contents.Add(new DummyPanel(), "Panel " + _count++, _internalImages, _count % 6);
        Content cC = _manager.Contents.Add(new RichTextBox(), "RichTextBox " + _count++, _internalImages, _count % 6);
        
        // Setup initial state to match menu selections
        DefineContentState(cA);
        DefineContentState(cB);
        DefineContentState(cC);

        // Setup the correct starting colors to match the menu selections
        DefineControlColors(cA);
        DefineControlColors(cB);
        DefineControlColors(cC);

        // Request a new Docking window be created for the first content on the left edge
        WindowContent wc = _manager.AddContentWithState(cA, State.DockLeft) as WindowContent;
        
        // Add two other content into the same Zone
        _manager.AddContentToZone(cB, wc.ParentZone, 1);
        _manager.AddContentToZone(cC, wc.ParentZone, 2);
    }

    protected void OnCreateC33(object sender, EventArgs e)
    {
        // Create three Content objects, one of each type
        Content cA = _manager.Contents.Add(new DummyForm(), "Form " + _count++, _internalImages, _count % 6);
        Content cB = _manager.Contents.Add(new DummyPanel(), "Panel " + _count++, _internalImages, _count % 6);
        Content cC = _manager.Contents.Add(new RichTextBox(), "RichTextBox " + _count++, _internalImages, _count % 6);

        // Setup initial state to match menu selections
        DefineContentState(cA);
        DefineContentState(cB);
        DefineContentState(cC);

        // Setup the correct starting colors to match the menu selections
        DefineControlColors(cA);
        DefineControlColors(cB);
        DefineControlColors(cC);

        // Request a new Docking window be created for the first content on the bottom edge
        WindowContent wc = _manager.AddContentWithState(cA, State.DockBottom) as WindowContent;
        
        // Add two other content into the same Window
        _manager.AddContentToWindowContent(cB, wc);
        _manager.AddContentToWindowContent(cC, wc);
    }
    
    protected void OnCreateFF(object sender, EventArgs e)
    {
        // Create three Content objects, one of each type
        Content cA = _manager.Contents.Add(new DummyForm(), "Form " + _count++, _internalImages, _count % 6);
        Content cB = _manager.Contents.Add(new DummyPanel(), "Panel " + _count++, _internalImages, _count % 6);
        Content cC = _manager.Contents.Add(new RichTextBox(), "RichTextBox " + _count++, _internalImages, _count % 6);

        // Define the initial floating form size
        cA.FloatingSize = new Size(250,450);

        // Setup initial state to match menu selections
        DefineContentState(cA);
        DefineContentState(cB);
        DefineContentState(cC);

        // Setup the correct starting colors to match the menu selections
        DefineControlColors(cA);
        DefineControlColors(cB);
        DefineControlColors(cC);

        // Request a new Docking window be created for the first content on the bottom edge
        WindowContent wc = _manager.AddContentWithState(cA, State.Floating) as WindowContent;
        
        // Add second content into the same Window
        _manager.AddContentToWindowContent(cB, wc);
        
        // Add third into same Zone
        _manager.AddContentToZone(cC, wc.ParentZone, 1);
    }
        
    protected void DefineContentState(Content c)
    {
        c.CaptionBar = _captionBars;
        c.CloseButton = _closeButtons;
    }
    
    protected void DefineControlColors(Content c)
    {
        // Only interested in Forms and Panels
        if ((c.Control is Form) || (c.Control is Panel))
        {
            // Starting color depends on select menu option
            switch(_colorIndex)
            {
                case 0:
                    c.Control.BackColor = SystemColors.Control;
                    c.Control.ForeColor = SystemColors.ControlText;
                    break;
                case 1:
                    c.Control.BackColor = Color.DarkSlateBlue;
                    c.Control.ForeColor = Color.White;
                    break;
                case 2:
                    c.Control.BackColor = Color.Firebrick;
                    c.Control.ForeColor = Color.White;
                    break;
                case 3:
                    c.Control.BackColor = Color.PaleGreen;
                    c.Control.ForeColor = Color.Black;
                    break;
            }
        }
    }

    protected void OnDeleteAll(object sender, EventArgs e)
    {
        _manager.Contents.Clear();
    }

    protected void OnShowAll(object sender, EventArgs e)
    {	
        _manager.ShowAllContents();
    }

    protected void OnHideAll(object sender, EventArgs e)
    {	
        _manager.HideAllContents();
    }

    protected void OnExit(object sender, EventArgs e)
    {	
        Close();
    }

    protected void OnSaveFile1(object sender, EventArgs e)
    {
        _manager.SaveConfigToFile("config1.xml");
    }

    protected void OnSaveFile2(object sender, EventArgs e)
    {
        _manager.SaveConfigToFile("config2.xml");
    }

    protected void OnLoadFile1(object sender, EventArgs e)
    {
        _manager.LoadConfigFromFile("config1.xml");
    }

    protected void OnLoadFile2(object sender, EventArgs e)
    {
        _manager.LoadConfigFromFile("config2.xml");
    }

    protected void OnSaveArray1(object sender, EventArgs e)
    {
        _slot1 = _manager.SaveConfigToArray();
    }

    protected void OnSaveArray2(object sender, EventArgs e)
    {
        _slot2 = _manager.SaveConfigToArray();
    }

    protected void OnLoadArray1(object sender, EventArgs e)
    {
        if (_slot1 != null)
            _manager.LoadConfigFromArray(_slot1);
    }

    protected void OnLoadArray2(object sender, EventArgs e)
    {
        if (_slot2 != null)
            _manager.LoadConfigFromArray(_slot2);
    }

    protected void OnResizeBarDefault(object sender, EventArgs e)
    {
        _manager.ResizeBarVector = -1;
    }

    protected void OnUpdateRSBD(object sender, EventArgs e)
    {
        MenuCommand updateCommand = sender as MenuCommand;
        updateCommand.Checked = (_manager.ResizeBarVector == -1);
    }

    protected void OnResizeBar1(object sender, EventArgs e)
    {
        _manager.ResizeBarVector = 1;
    }

    protected void OnUpdateRSB1(object sender, EventArgs e)
    {
        MenuCommand updateCommand = sender as MenuCommand;
        updateCommand.Checked = (_manager.ResizeBarVector == 1);
    }

    protected void OnResizeBar5(object sender, EventArgs e)
    {
        _manager.ResizeBarVector = 5;
    }

    protected void OnUpdateRSB5(object sender, EventArgs e)
    {
        MenuCommand updateCommand = sender as MenuCommand;
        updateCommand.Checked = (_manager.ResizeBarVector == 5);
    }

    protected void OnResizeBar7(object sender, EventArgs e)
    {
        _manager.ResizeBarVector = 7;
    }

    protected void OnUpdateRSB7(object sender, EventArgs e)
    {
        MenuCommand updateCommand = sender as MenuCommand;
        updateCommand.Checked = (_manager.ResizeBarVector == 7);
    }
    
    protected void OnCaptionBars(object sender, EventArgs e)
    {
        _captionBars = (_captionBars == false);
        
        foreach(Content c in _manager.Contents)
            c.CaptionBar = _captionBars;
    }

    protected void OnUpdateCaptionBars(object sender, EventArgs e)
    {
        MenuCommand updateCommand = sender as MenuCommand;
        updateCommand.Checked = _captionBars;
    }
    
    protected void OnCloseButtons(object sender, EventArgs e)
    {
        _closeButtons = (_closeButtons == false);
        
        foreach(Content c in _manager.Contents)
            c.CloseButton = _closeButtons;
    }

    protected void OnUpdateCloseButtons(object sender, EventArgs e)
    {
        MenuCommand updateCommand = sender as MenuCommand;
        updateCommand.Checked = _closeButtons;
    }

    protected void OnAllowAllCloseButton(object sender, EventArgs e)
    {
        _ignoreClose = 0;
    }

    protected void OnUpdateAllowAll(object sender, EventArgs e)
    {
        MenuCommand updateCommand = sender as MenuCommand;
        updateCommand.Checked = (_ignoreClose == 0);
    }

    protected void OnIgnoreAllCloseButton(object sender, EventArgs e)
    {
        _ignoreClose = 1;
    }

    protected void OnUpdateIgnoreAll(object sender, EventArgs e)
    {
        MenuCommand updateCommand = sender as MenuCommand;
        updateCommand.Checked = (_ignoreClose == 1);
    }

    protected void OnIgnoreAllPanelButton(object sender, EventArgs e)
    {
        _ignoreClose = 2;
    }

    protected void OnUpdateIgnorePanel(object sender, EventArgs e)
    {
        MenuCommand updateCommand = sender as MenuCommand;
        updateCommand.Checked = (_ignoreClose == 2);
    }

    protected void OnIgnoreAllFormButton(object sender, EventArgs e)
    {
        _ignoreClose = 3;
    }

    protected void OnUpdateIgnoreForm(object sender, EventArgs e)
    {
        MenuCommand updateCommand = sender as MenuCommand;
        updateCommand.Checked = (_ignoreClose == 3);
    }

    protected void OnIgnoreAllTextboxButton(object sender, EventArgs e)
    {
        _ignoreClose = 4;
    }

    protected void OnUpdateIgnoreTextBox(object sender, EventArgs e)
    {
        MenuCommand updateCommand = sender as MenuCommand;
        updateCommand.Checked = (_ignoreClose == 4);
    }
    
    protected void OnAllowMinMax(object sender, EventArgs e)
    {
        _manager.ZoneMinMax = (_manager.ZoneMinMax == false);
    }

    protected void OnUpdateAllowMinMax(object sender, EventArgs e)
    {
        MenuCommand updateCommand = sender as MenuCommand;
        updateCommand.Checked = _manager.ZoneMinMax;
    }

    protected void OnPlainTabBorder(object sender, EventArgs e)
    {
        _manager.PlainTabBorder = (_manager.PlainTabBorder == false);
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -