private void ApplyColors(Control parent) { foreach (Control control in parent.Controls) { if (control is FlatTabControl) { FlatTabControl tabView = control as FlatTabControl; tabView.UpdateColors(); // TabControls embedded in plugins probably do not use the main background color. // If that is required we have to reach through to those specific places and fix that individually. //tabView.BackgroundColor = Conversions.GetApplicationColor(ApplicationColor.AppColorMainBackground, false); } else if (control is HeaderPanel) { HeaderPanel panel = control as HeaderPanel; panel.HeaderColor = Conversions.GetApplicationColor(ApplicationColor.AppColorPanelHeader, false); panel.ForeColor = Conversions.GetApplicationColor(ApplicationColor.AppColorPanelHeader, true); panel.HeaderColorFocused = Conversions.GetApplicationColor(ApplicationColor.AppColorPanelHeaderFocused, false); panel.ForeColorFocused = Conversions.GetApplicationColor(ApplicationColor.AppColorPanelHeaderFocused, true); } else if (control is ToolStrip) { ToolStrip toolStrip = control as ToolStrip; toolStrip.BackColor = Conversions.GetApplicationColor(ApplicationColor.AppColorPanelToolbar, false); toolStrip.ForeColor = Conversions.GetApplicationColor(ApplicationColor.AppColorPanelToolbar, true); } else if (control is TabPage) { TabPage page = control as TabPage; if (page.Parent is FlatTabControl) { FlatTabControl view = page.Parent as FlatTabControl; if (view.TabStyle == FlatTabControl.TabStyleType.BottomNormal) { page.BackColor = Conversions.GetApplicationColor(ApplicationColor.AppColorPanelContentArea, false); } } } if (control.ContextMenuStrip != null) { if (Conversions.UseWin8Drawing()) { control.ContextMenuStrip.Renderer = new Win8MenuStripRenderer(); } else { control.ContextMenuStrip.Renderer = new TransparentMenuStripRenderer(); } } ApplyColors(control); } }
private void ApplyColors(Control parent) { foreach (Control control in parent.Controls) { if (control is FlatTabControl) { FlatTabControl tabView = control as FlatTabControl; tabView.UpdateColors(); tabView.BackgroundColor = Conversions.GetApplicationColor(ApplicationColor.AppColorMainBackground, false); } else if (control is HeaderPanel) { HeaderPanel panel = control as HeaderPanel; panel.HeaderColor = Conversions.GetApplicationColor(ApplicationColor.AppColorPanelHeader, false); panel.ForeColor = Conversions.GetApplicationColor(ApplicationColor.AppColorPanelHeader, true); panel.HeaderColorFocused = Conversions.GetApplicationColor(ApplicationColor.AppColorPanelHeaderFocused, false); panel.ForeColorFocused = Conversions.GetApplicationColor(ApplicationColor.AppColorPanelHeaderFocused, true); } else if (control is ToolStrip) { ToolStrip toolStrip = control as ToolStrip; toolStrip.BackColor = Conversions.GetApplicationColor(ApplicationColor.AppColorPanelToolbar, false); toolStrip.ForeColor = Conversions.GetApplicationColor(ApplicationColor.AppColorPanelToolbar, true); } else if (control is TabPage) { TabPage page = control as TabPage; if (page.Parent is FlatTabControl) { FlatTabControl view = page.Parent as FlatTabControl; if (view.TabStyle == FlatTabControl.TabStyleType.BottomNormal) { page.BackColor = Conversions.GetApplicationColor(ApplicationColor.AppColorPanelContentArea, false); } } } ApplyColors(control); } }