예제 #1
0
 private void RestoreStripLayout(ToolStripSettingElement setting, ToolStrip strip)
 {
     if (strip != null)
     {
         strip.Visible = setting.Visible;
         this.JoinPanelOnLastPosition(strip, setting);
     }
 }
예제 #2
0
        private void JoinPanelOnLastPosition(ToolStrip strip, ToolStripSettingElement setting)
        {
            ToolStripPanel toolStripPanel = this.GetToolStripPanelToJoin(setting);

            if (!toolStripPanel.Controls.Contains(strip))
            {
                Point lastPosition = new Point(setting.Left, setting.Top);
                toolStripPanel.Join(strip, lastPosition);
            }
            else // set position only when comming from fullscreen
            {
                ApplyLastPosition(setting, strip);
            }
        }
예제 #3
0
        private ToolStripPanel GetToolStripPanelToJoin(ToolStripSettingElement setting)
        {
            switch (setting.Dock)
            {
            case "Left":
                return(this.LeftToolStripPanel);

            case "Right":
                return(this.RightToolStripPanel);

            case "Bottom":
                return(this.BottomToolStripPanel);

            default:     // defensive position
                return(this.TopToolStripPanel);
            }
        }
예제 #4
0
        private ToolStripMenuItem FindMenuForSetting(ToolStripSettingElement setting)
        {
            if (setting.Name == this.toolbarStd.Name)
            {
                return(this.standardToolbarToolStripMenuItem);
            }

            if (setting.Name == this.favoriteToolBar.Name)
            {
                return(this.toolStripMenuItemShowHideFavoriteToolbar);
            }

            if (setting.Name == this.SpecialCommandsToolStrip.Name)
            {
                return(this.shortcutsToolStripMenuItem);
            }

            return(null);
        }
예제 #5
0
        private ToolStrip FindToolStripForSetting(ToolStripSettingElement setting)
        {
            if (setting.Name == this.toolbarStd.Name)
            {
                return(this.toolbarStd);
            }

            if (setting.Name == this.favoriteToolBar.Name)
            {
                return(this.favoriteToolBar);
            }

            if (setting.Name == this.SpecialCommandsToolStrip.Name)
            {
                return(this.SpecialCommandsToolStrip);
            }

            if (setting.Name == this.menuStrip.Name)
            {
                return(this.menuStrip);
            }

            return(null);
        }
예제 #6
0
 private static void ApplyLastPosition(ToolStripSettingElement setting, ToolStrip strip)
 {
     strip.Left = setting.Left;
     strip.Top  = setting.Top;
 }