Beispiel #1
0
        /// <summary>
        /// Popup selected pane when control is collapsed. When control is collapsed (Expanded=false) currently selected pane is not visible
        /// calling this method will popup selected pane and allow user access to it. Use PopupPaneVisible property
        /// to check whether currently selected pane is displayed as popup.
        /// </summary>
        private void PopupSelectedPane()
        {
            if (m_PopupPaneVisible)
                return;
            Control selectedNavPane = null;
            foreach (Control c in this.Controls)
            {
                if (c is NavigationPanePanel && ((NavigationPanePanel)c).ParentItem == this.CheckedButton)
                {
                    selectedNavPane = c;
                    break;
                }
            }
            if (selectedNavPane == null)
                return;

			// Animation start and end rectangles
			int h = navBar.Top - panelTitle.Bottom;
			Rectangle targetRect = new Rectangle(this.Width, panelTitle.Bottom, m_ExpandedSize, h);
			Rectangle startRect = new Rectangle(this.Width, panelTitle.Bottom, 16, h);

			if(BeforePanelPopup!=null)
			{
				PanelPopupEventArgs args=new PanelPopupEventArgs(targetRect);
				BeforePanelPopup(this, args);
                if(args.Cancel)
					return;
				targetRect=args.PopupBounds;
			}

            Control parentForm = this.FindForm();
            if (parentForm == null)
                parentForm = this.TopLevelControl;
            if (parentForm == null)
                parentForm = this.Parent;

            m_PopupPanelContainer = new PanelEx();
            m_PopupPanelContainer.Visible = false;
            m_PopupPanelContainer.ApplyLabelStyle();
            m_PopupPanelContainer.AntiAlias = this.AntiAlias;
            //m_PopupPanelContainer.Style.BorderSide = eBorderSide.All;
            //m_PopupPanelContainer.Style.Border = eBorderType.SingleLine;
            //m_PopupPanelContainer.Style.BorderWidth = 1;
            //m_PopupPanelContainer.Style.BorderColor.Color = panelTitle.Style.BorderColor.Color;
            //m_PopupPanelContainer.DockPadding.All = 1;
            parentForm.Controls.Add(m_PopupPanelContainer);
            m_PopupPanelContainer.BringToFront();
            this.Controls.Remove(selectedNavPane);
            if (selectedNavPane is NavigationPanePanel)
            {
                NavigationPanePanel panel = ((NavigationPanePanel)selectedNavPane);
                panel.DockPadding.Bottom = 1;
                if (panel.Style.Border == eBorderType.None)
                {
                    m_PopupPanelContainer.Style.BorderSide = eBorderSide.All;
                    m_PopupPanelContainer.Style.Border = eBorderType.SingleLine;
                    m_PopupPanelContainer.Style.BorderWidth = 1;
                    m_PopupPanelContainer.Style.BorderColor.Color = panelTitle.Style.BorderColor.Color;
                    m_PopupPanelContainer.DockPadding.All = 1;
                }
            }
            m_PopupPanelContainer.Controls.Add(selectedNavPane);
            selectedNavPane.Visible = true;

            if (this.Dock == DockStyle.Right)
            {
                targetRect.Offset(-(this.Width + targetRect.Width), 0);
                startRect.Offset(-(this.Width + startRect.Width), 0);
            }

            Point p = this.PointToScreen(targetRect.Location);
            targetRect.Location = parentForm.PointToClient(p);
            p = this.PointToScreen(startRect.Location);
            startRect.Location = parentForm.PointToClient(p);

            if (AnimationTime == 0)
            {
                m_PopupPanelContainer.Bounds = targetRect;
                m_PopupPanelContainer.Visible = true;
            }
            else
                BarFunctions.AnimateControl(m_PopupPanelContainer, true, AnimationTime, startRect, targetRect);

            m_PopupPanelContainer.Focus();
            m_PopupPanelContainer.Leave += new EventHandler(m_PopupPanelContainer_Leave);
            m_PopupPaneVisible = true;

            if (AfterPanelPopup != null)
                AfterPanelPopup(this, new EventArgs());
        }
Beispiel #2
0
 private void navigationPane1_BeforePanelPopup(object sender, DevComponents.DotNetBar.PanelPopupEventArgs e)
 {
     textEvents.Text += DateTime.Now.ToString() + " - BeforePanelPopup\r\n";
 }