示例#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());
        }
示例#2
0
 private void SetupExpandVerticalPane()
 {
     m_VerticalExpandPane = new PanelEx();
     m_VerticalExpandPane.ColorSchemeStyle = this.ColorSchemeStyle;
     m_VerticalExpandPane.ColorScheme = this.ColorScheme;
     m_VerticalExpandPane.ApplyButtonStyle();
     m_VerticalExpandPane.Style.VerticalText = true;
     m_VerticalExpandPane.Style.ForeColor.ColorSchemePart = eColorSchemePart.PanelText;
     m_VerticalExpandPane.Style.BackColor1.ColorSchemePart = eColorSchemePart.PanelBackground;
     m_VerticalExpandPane.Style.ResetBackColor2();
     m_VerticalExpandPane.StyleMouseOver.VerticalText = true;
     m_VerticalExpandPane.StyleMouseDown.VerticalText = true;
     m_VerticalExpandPane.Dock = DockStyle.Fill;
     m_VerticalExpandPane.Text = TitlePanel.Text;
     
     this.Controls.Add(m_VerticalExpandPane);
     if(this.TitleStyle.Font!=null)
         m_VerticalExpandPane.Font = this.TitleStyle.Font;
     else if (TitlePanel.Font != null)
         m_VerticalExpandPane.Font = TitlePanel.Font;
     m_VerticalExpandPane.Click += new EventHandler(VerticalExpandPaneClick);
     m_VerticalExpandPane.BringToFront();
 }
示例#3
0
        /// <summary>
        /// 主选项鼠标单击事件.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lblOption_Click(object sender, EventArgs e)
        {
            //判断是否已选中.
            if ((optionState)((LabelX)sender).Tag == optionState.CHECKED
                ||
                (optionState)((LabelX)sender).Tag == optionState.MAINCHECKED)
                return;

            //设置所有选项为未选中.
            foreach (LabelX lbl in ((LabelX)sender).Parent.Controls)
            {
                if ((optionState)lbl.Tag == optionState.MAINCHECKED)
                    lbl.Tag = optionState.MAINUNCHECK;
                else if ((optionState)lbl.Tag == optionState.CHECKED)
                {
                    pnlPrevious = dicSelectOptions[lbl];
                    lbl.Tag = optionState.UNCHECK;
                }
                lbl.BackColor = colUnCheck;
                lbl.ForeColor = colUnCheckFore;
                lbl.BackgroundStyle.BorderLeft = eStyleBorderType.None;
            }

            //选中当前选项.
            if ((optionState)((LabelX)sender).Tag == optionState.MAINUNCHECK)
                ((LabelX)sender).Tag = optionState.MAINCHECKED;
            else
                ((LabelX)sender).Tag = optionState.CHECKED;
            ((LabelX)sender).BackColor = colChecked;
            ((LabelX)sender).ForeColor = colCheckedFore;
            ((LabelX)sender).BackgroundStyle.BorderLeft = eStyleBorderType.Solid;
            ((LabelX)sender).BackgroundStyle.BorderLeftWidth = 4;
            ((LabelX)sender).BackgroundStyle.BorderLeftColor = pnlSelectMenuTop.Style.BackColor1.Color;

            #region 面板动画初始化
            //判断是否存在面板对象.
            if ((optionState)((LabelX)sender).Tag != optionState.MAINCHECKED && dicSelectOptions[((LabelX)sender)] == null)
                return;

            //判断前一动画是否执行完毕.
            if (timeOptionAnimate != null && timeOptionAnimate.Enabled)
            {
                timeOptionAnimate.Stop();

                if (pnlPrevious != null)
                    pnlPrevious.Dock = System.Windows.Forms.DockStyle.Fill;
            }

            //初始化动画时间控件.
            timeOptionAnimate = new System.Windows.Forms.Timer();
            timeOptionAnimate.Enabled = false;
            timeOptionAnimate.Interval = 1;

            //判断动画效果.
            if ((optionState)((LabelX)sender).Tag == optionState.MAINCHECKED)
            {
                //判断是否存在面板.
                if (pnlPrevious == null)
                    return;

                //挂载动画事件.
                timeOptionAnimate.Tick += new EventHandler(timeOptionAnimateClose_Tick);

                //设置除前一面板外所有面板为隐藏.
                foreach (System.Windows.Forms.Control ctrlTEMP in pnlCenterContent.Controls)
                {
                    if (ctrlTEMP.GetType() == typeof(PanelEx) && ((PanelEx)ctrlTEMP).Tag != null)
                    {
                        PanelEx pnl = ((PanelEx)ctrlTEMP);

                        if (pnlPrevious != pnl)
                            pnl.Visible = false;
                    }
                }

                //为动画进行属性初始化.
                intWidth = pnlPrevious.Width;
                intHeight = pnlPrevious.Height;
                intWidthSub = intWidth / 10;

                pnlPrevious.Dock = System.Windows.Forms.DockStyle.None;
                pnlPrevious.Location = new Point(0, 0);
                pnlPrevious.Width = intWidth;
                pnlPrevious.Height = intHeight;
            }
            else
            {
                //挂载动画事件.
                timeOptionAnimate.Tick += new EventHandler(timeOptionAnimateOpen_Tick);

                pnlCurrent = dicSelectOptions[((LabelX)sender)];

                //为动画进行属性初始化.
                pnlCurrent.Visible = true;
                pnlCurrent.BringToFront();

                pnlCurrent.Dock = System.Windows.Forms.DockStyle.Fill;

                intWidth = pnlCurrent.Width;
                intHeight = pnlCurrent.Height;
                intWidthSub = intWidth / 10;

                pnlCurrent.Dock = System.Windows.Forms.DockStyle.None;
                pnlCurrent.Location = new Point(-intWidth, 0);
                pnlCurrent.Width = intWidth;
                pnlCurrent.Height = intHeight;
            }
            #endregion
            timeOptionAnimate.Start();
        }