private void OnDoubleClickTab(DotNetMagic.Controls.TabControl tc, DotNetMagic.Controls.TabPage page) { // Is the user allowed to redock? if (DockingManager.AllowRedocking) { Content c = (Content)page.Tag; // Make Content record its current position and remember it for the future c.RecordRestore(); // Invert docked status c.Docked = (c.Docked == false); // Remove from current WindowContent and restore its position DockingManager.HideContent(c, false, true); DockingManager.ShowContent(c); // Raise event to indicate a double click occured DockingManager.OnDoubleClickDock(); } }
/// <summary> /// Initializes a new instance of the WindowContent class. /// </summary> /// <param name="manager">Parent docking manager instance.</param> /// <param name="vs">Visual style for drawing.</param> public WindowContentTabbed(DockingManager manager, VisualStyle vs) : base(manager, vs) { _redocker = null; // Create the TabControl used for viewing the Content windows _tabControl = new DotNetMagic.Controls.TabControl(); _tabControl.ShowTabPageClose = false; _tabControl.Customize = manager.Customize; // 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 = 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 SelectTabHandler(OnSelectionChanged); _tabControl.PageDragStart += new PageDragStartHandler(OnPageDragStart); _tabControl.PageDragMove += new MouseEventHandler(OnPageDragMove); _tabControl.PageDragEnd += new PageDragHandler(OnPageDragEnd); _tabControl.PageDragQuit += new PageDragHandler(OnPageDragQuit); _tabControl.PageMoved += new PageMovedHandler(OnPageMoved); _tabControl.DoubleClickTab += new DoubleClickTabHandler(OnDoubleClickTab); _tabControl.Font = manager.TabControlFont; _tabControl.BackColor = manager.BackColor; _tabControl.ForeColor = manager.InactiveTextColor; _tabControl.OfficePixelBorder = false; _tabControl.OfficeExtraTabInset = 5; _tabControl.OfficeDockSides = true; _tabControl.OfficeHeaderBorder = true; _tabControl.IDE2005PixelBorder = true; _tabControl.IDE2005HeaderBorder = false; _tabControl.IDE2005TabJoined = false; _tabControl.IDE2005ExtraTabInset = 0; _tabControl.DragOutside = true; // Define the visual style required _tabControl.Style = vs; // Allow developers a chance to override default settings manager.OnTabControlCreated(_tabControl); switch (vs) { case VisualStyle.IDE: case VisualStyle.IDE2005: case VisualStyle.Office2003: Controls.Add(_tabControl); break; case VisualStyle.Plain: // Only the border at the pages edge and not around the whole control _tabControl.InsetBorderPagesOnly = !DockingManager.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 = DockingManager.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); }