private void RestoreStripLayout(ToolStripSettingElement setting, ToolStrip strip) { if (strip != null) { strip.Visible = setting.Visible; this.JoinPanelOnLastPosition(strip, setting); } }
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); } }
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); } }
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); }
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); }
private static void ApplyLastPosition(ToolStripSettingElement setting, ToolStrip strip) { strip.Left = setting.Left; strip.Top = setting.Top; }