/// <summary> /// Initialize a new instance of the KryptonAutoHiddenSlidePanel class. /// </summary> /// <param name="control">Reference to control that is being managed.</param> /// <param name="edge">Docking edge being managed.</param> /// <param name="panel">Reference to auto hidden panel for this edge.</param> public KryptonAutoHiddenSlidePanel(Control control, DockingEdge edge, KryptonAutoHiddenPanel panel) { _control = control; _edge = edge; _panel = panel; _state = DockingAutoHiddenShowState.Hidden; _checkMakeHidden = OnCheckMakeHidden; // We need to a timer to automate sliding in and out _slideTimer = new System.Windows.Forms.Timer { Interval = SLIDE_INTERVAL }; _slideTimer.Tick += OnSlideTimerTick; // Timer used to delay between notification of need to slide inwards and performing actual slide _dismissTimer = new System.Windows.Forms.Timer { Interval = DISMISS_INTERVAL }; _dismissTimer.Tick += OnDismissTimerTick; _dismissRunning = false; // Create inner panel that holds the actual dockspace and separator _dockspaceSlide = new KryptonDockspaceSlide { Dock = DockStyle.Fill, AutoHiddenHost = true }; _dockspaceSlide.PageCloseClicked += OnDockspacePageCloseClicked; _dockspaceSlide.PageAutoHiddenClicked += OnDockspacePageAutoHiddenClicked; _dockspaceSlide.PageDropDownClicked += OnDockspacePageDropDownClicked; SeparatorControl = new KryptonDockspaceSeparator(edge, true); SeparatorControl.SplitterMoving += OnDockspaceSeparatorMoving; SeparatorControl.SplitterMoved += OnDockspaceSeparatorMoved; SeparatorControl.SplitterMoveRect += OnDockspaceSeparatorMoveRect; _inner = new KryptonPanel(); _inner.Controls.AddRange(new Control[] { _dockspaceSlide, SeparatorControl }); Controls.Add(_inner); // Do not show ourself until we are needed Visible = false; // Add a Button that is not showing and used to push focus away from the dockspace _dummyTarget = new Button { Location = new Point(-200, -200), Size = new Size(100, 100) }; Controls.Add(_dummyTarget); // Add ourself into the target control for docking control.SizeChanged += OnControlSizeChanged; control.Controls.Add(this); // Need to peek at windows messages so we can determine if mouse is over the slide out panel Application.AddMessageFilter(this); }
private void OnSlidePanelSeparatorMoveRect(object sender, SplitterMoveRectMenuArgs e) { // Cast to correct type and grab associated dockspace control KryptonDockspaceSeparator separatorControl = (KryptonDockspaceSeparator)sender; KryptonDockspace dockspaceControl = _slidePanel.DockspaceControl; KryptonPage page = _slidePanel.Page; // Events are generated from the parent docking manager KryptonDockingManager dockingManager = DockingManager; if (dockingManager != null) { // Allow the movement rectangle to be modified by event handlers AutoHiddenSeparatorResizeEventArgs autoHiddenSeparatorResizeRectArgs = new(separatorControl, dockspaceControl, page, FindMovementRect(e.MoveRect)); dockingManager.RaiseAutoHiddenSeparatorResize(autoHiddenSeparatorResizeRectArgs); e.MoveRect = autoHiddenSeparatorResizeRectArgs.ResizeRect; } }