public override void PropogateNameValue(PropogateName name, object value) { base.PropogateNameValue(name, value); switch (name) { case PropogateName.BackColor: Color newColor = (Color)value; // In Plain style we need to color the intermidiate window as well if (_style == VisualStyle.Plain) { BorderForControl bfc = this.Controls[0] as BorderForControl; bfc.BackColor = newColor; } _tabControl.BackColor = newColor; this.BackColor = newColor; Invalidate(); break; case PropogateName.InactiveTextColor: _tabControl.ForeColor = (Color)value; break; case PropogateName.PlainTabBorder: _tabControl.InsetBorderPagesOnly = !(bool)value; break; case PropogateName.TabControlFont: _tabControl.Font = (Font)value; break; } }
public WindowContentTabbed(DockingManager manager, VisualStyle vs) : base(manager, vs) { _redocker = null; _activeContent = null; // Create the TabControl used for viewing the Content windows _tabControl = new Magic.Controls.TabControl(); // It should always occupy the remaining space after all details _tabControl.Dock = DockStyle.Fill; // Show tabs only if two or more tab pages exist _tabControl.HideTabsMode = Magic.Controls.TabControl.HideTabsModes.HideUsingLogic; // Hook into the TabControl notifications _tabControl.GotFocus += new EventHandler(OnTabControlGotFocus); _tabControl.LostFocus += new EventHandler(OnTabControlLostFocus); _tabControl.PageGotFocus += new EventHandler(OnTabControlGotFocus); _tabControl.PageLostFocus += new EventHandler(OnTabControlLostFocus); _tabControl.SelectionChanged += new EventHandler(OnSelectionChanged); _tabControl.PageDragStart += new MouseEventHandler(OnPageDragStart); _tabControl.PageDragMove += new MouseEventHandler(OnPageDragMove); _tabControl.PageDragEnd += new MouseEventHandler(OnPageDragEnd); _tabControl.PageDragQuit += new MouseEventHandler(OnPageDragQuit); _tabControl.DoubleClickTab += new Magic.Controls.TabControl.DoubleClickTabHandler(OnDoubleClickTab); _tabControl.Font = manager.TabControlFont; _tabControl.BackColor = manager.BackColor; _tabControl.ForeColor = manager.InactiveTextColor; // Define the visual style required _tabControl.Style = vs; // Allow developers a chance to override default settings manager.OnTabControlCreated(_tabControl); switch (vs) { case VisualStyle.IDE: Controls.Add(_tabControl); break; case VisualStyle.Plain: // Only the border at the pages edge and not around the whole control _tabControl.InsetBorderPagesOnly = !_manager.PlainTabBorder; // We want a border around the TabControl so it is indented and looks consistent // with the Plain look and feel, so use the helper Control 'BorderForControl' BorderForControl bfc = new BorderForControl(_tabControl, _plainBorder); // It should always occupy the remaining space after all details bfc.Dock = DockStyle.Fill; // Define the default border border bfc.BackColor = _manager.BackColor; // When in 'VisualStyle.Plain' we need to Controls.Add(bfc); break; } // Need to hook into message pump so that the ESCAPE key can be // intercepted when in redocking mode Application.AddMessageFilter(this); }