/// <summary>
        /// Overrides the base class function to handle drag of panels and resizing.
        /// </summary>
        /// <param name="e">A MouseEventArgs that contains the mouse data.</param>
        protected override void OnMouseMove(MouseEventArgs e)
        {
            bool inPanelBar = ((panelList.Count > 1) && (e.Y > this.Height-this.DockPadding.Bottom) && (this.DockType != DockContainerType.Document)) || ((e.Y < bottomDock)  && (this.DockType == DockContainerType.Document));

            if (inPanelBar && (this.ClientRectangle.Contains(e.X, e.Y)))
            {
                // Display tool-tip.
                UpdateToolTip(new Point(e.X, e.Y));
            }
            else
            {
                // Check panel movement.
                if ((e.Button == MouseButtons.Left) && (activePanel != null) && !ptStart.Equals(new Point(e.X, e.Y)))
                {
                    Rectangle rc = RectangleToScreen(ClientRectangle);
                    DockWindow form = activePanel.Form;

                    if (dragWindow == null)
                    {
                        dragWindow = new DockWindow();
                        dragWindow.IsDragWindow = true;
                        dragWindow.Size = form.Size;
                        dragWindow.DockType = this.DockType;
                        DockContainer c = TopLevelContainer;
                        if (c != null)
                            dragWindow.DragWindow += new DockEventHandler(c.DragWindow);
                        dragWindow.Show();
                    }

                    if (dragWindow.dragTarget == null)
                        dragWindow.Location = new Point(e.X+rc.X-10, e.Y+rc.Y-10);
                    else
                        dragWindow.MoveWindow();

                    if (dragWindow.dragTarget == null)
                        dragWindow.Size = form.Size;
                }
            }

            base.OnMouseMove(e);
        }
 /// <summary>
 /// Creates an attached drag window.
 /// </summary>
 private void ShowDragWindow()
 {
     if (!isDragWindow)
     {
         Rectangle rc = RectangleToScreen(this.Bounds);
         dragWindow = new DockWindow();
         dragWindow.IsDragWindow = true;
         dragWindow.Size = this.Size;
         dragWindow.DockType = this.DockType;
         dragWindow.DragWindow += DragWindow;
         dragWindow.Show();
         dragWindow.Location = this.Location;
     }
 }
        /// <summary>
        /// Releases a DockWindow from the container.
        /// The container may destroy itself at the end of this procedure if it is empty and removeable.
        /// </summary>
        /// <param name="form">The DockWindow that is to be released.</param>
        /// <returns>The success of the operation.</returns>
        internal bool ReleaseWindow(DockWindow form)
        {
            bool ret = false;

            if (this.Controls.Contains(form.ControlContainer))
            {
                form.Controls.Add(form.ControlContainer);
                form.Show();
                ret = true;
            }

            if ((panelList.Count == 0) && (containerList.Count == 0) && (this.Parent is DockContainer) && (removeable))
            {
                (this.Parent as DockContainer).RemoveContainer(this);
            }

            return ret;
        }
        /// <summary>
        /// Adds a panel to the container.
        /// </summary>
        /// <param name="src">The source window of the panel.</param>
        /// <param name="pt">The target position.</param>
        public void AddPanel(DockWindow src, Point pt)
        {
            try
            {
                if (!src.IsLoaded)
                    src.CreateContainer();

                blockFocusEvents = true;
                DockPanel panel = src.ControlContainer;
                this.Controls.Add(panel);
                ActivePanel = panel;
                blockFocusEvents = false;

                if (!src.IsLoaded)
                    src.Show();

                src.Hide();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }