private void SaveToolStripPanel(ToolStripPanel panel, string position, ToolStripSettingElementCollection newSettings) { int rowIndex = 0; foreach (ToolStripPanelRow row in panel.Rows) { this.SaveToolStripRow(row, newSettings, position, rowIndex); rowIndex++; } }
public void SaveLayout() { if (!Settings.ToolbarsLocked) { ToolStripSettingElementCollection newSettings = new ToolStripSettingElementCollection(); this.SaveToolStripPanel(this.TopToolStripPanel, "Top", newSettings); this.SaveToolStripPanel(this.LeftToolStripPanel, "Left", newSettings); this.SaveToolStripPanel(this.RightToolStripPanel, "Right", newSettings); this.SaveToolStripPanel(this.BottomToolStripPanel, "Bottom", newSettings); Settings.ToolbarSettings = newSettings; } }
private void SaveToolStripRow(ToolStripPanelRow row, ToolStripSettingElementCollection newSettings, string position, int rowIndex) { foreach (ToolStrip strip in row.Controls) { newSettings.Add(new ToolStripSettingElement { Dock = position, Row = rowIndex, Left = strip.Left, Top = strip.Top, Name = strip.Name, Visible = strip.Visible }); } }
private void ReJoinAllPanels(ToolStripSettingElementCollection newSettings) { foreach (ToolStripSettingElement setting in newSettings) { ToolStrip strip = this.FindToolStripForSetting(setting); ToolStripMenuItem menuItem = this.FindMenuForSetting(setting); if (menuItem != null) { menuItem.Checked = setting.Visible; } this.RestoreStripLayout(setting, strip); } }
private void AplyAllPanelPositions(ToolStripSettingElementCollection newSettings) { foreach (ToolStripSettingElement setting in newSettings) { ToolStrip strip = this.FindToolStripForSetting(setting); if (strip == null) continue; strip.GripStyle = ToolStripGripStyle.Visible; ApplyLastPosition(setting, strip); } }