コード例 #1
0
        private Size CalcSize(BaseTabPageViewInfo info, Size PageSize)
        {
            BaseTabPageViewInfoDescendant infodes      = info as BaseTabPageViewInfoDescendant;
            TabButtonsPanelDescendant     ButtonsPanel = infodes.PagePanel;
            Graphics g = GraphicsInfo.Graphics;

            ButtonsPanel.CreateButtons(TabButtons.None);
            Size      ButtonsSize = ButtonsPanel.CalcSize(g);
            Rectangle pageBounds  = infodes.Bounds;
            Rectangle rect        = Rectangle.Empty;

            if (!ButtonsSize.IsEmpty)
            {
                rect = new Rectangle(pageBounds.X + pageBounds.Width - ButtonsSize.Width, pageBounds.Y + pageBounds.Height - ButtonsSize.Height,
                                     ButtonsSize.Width, ButtonsSize.Height);
            }
            if ((HeaderLocation == TabHeaderLocation.Top || HeaderLocation == TabHeaderLocation.Bottom) &&
                (RealPageOrientation == TabOrientation.Horizontal || RealPageOrientation == TabOrientation.Default))
            {
                PageSize.Width += ButtonsSize.Width;
            }
            if ((HeaderLocation == TabHeaderLocation.Top || HeaderLocation == TabHeaderLocation.Bottom) &&
                RealPageOrientation == TabOrientation.Vertical)
            {
                PageSize.Width   = Math.Max(ButtonsSize.Width, PageSize.Width);
                PageSize.Height += ButtonsSize.Height;
            }
            if ((HeaderLocation == TabHeaderLocation.Right || HeaderLocation == TabHeaderLocation.Left) &&
                RealPageOrientation == TabOrientation.Horizontal)
            {
                PageSize.Width += ButtonsSize.Width;
                PageSize.Height = Math.Max(ButtonsSize.Height, PageSize.Height);
            }
            if ((HeaderLocation == TabHeaderLocation.Right || HeaderLocation == TabHeaderLocation.Left) &&
                (RealPageOrientation == TabOrientation.Default || RealPageOrientation == TabOrientation.Vertical))
            {
                PageSize.Height += ButtonsSize.Height;
                PageSize.Width   = Math.Max(ButtonsSize.Width, PageSize.Width);
            }
            ButtonsPanel.Bounds = rect;
            return(PageSize);
        }
コード例 #2
0
        protected override Rectangle CalcPageFocusBounds(BaseTabPageViewInfo info, Rectangle contentBounds)
        {
            Rectangle FocusRect = base.CalcPageFocusBounds(info, contentBounds);
            BaseTabPageViewInfoDescendant infodes      = info as BaseTabPageViewInfoDescendant;
            TabButtonsPanelDescendant     ButtonsPanel = infodes.PagePanel;
            Rectangle PanelBounds = ButtonsPanel.Bounds;
            int       X = 0, Y = 0;

            if ((HeaderLocation == TabHeaderLocation.Top || HeaderLocation == TabHeaderLocation.Bottom) &&
                (RealPageOrientation == TabOrientation.Horizontal || RealPageOrientation == TabOrientation.Default))
            {
                FocusRect.Width += CalcPageIndent(info, IndentType.Top);
                FocusRect.Width -= PanelBounds.Width;
                X = FocusRect.Right;
                Y = (infodes.Bounds.Height - PanelBounds.Height) / 2 + infodes.Bounds.Y;
            }
            if (HeaderLocation == TabHeaderLocation.Top &&
                RealPageOrientation == TabOrientation.Vertical)
            {
                FocusRect.Height += CalcPageIndent(info, IndentType.Top);
                FocusRect.Height -= ButtonsPanel.Bounds.Height;
                FocusRect.Y      += ButtonsPanel.Bounds.Height - CalcPageIndent(info, IndentType.Top);
                X = (infodes.Bounds.Width - PanelBounds.Width) / 2 + infodes.Bounds.X;
                Y = FocusRect.Top - PanelBounds.Height;
            }
            if (HeaderLocation == TabHeaderLocation.Bottom &&
                RealPageOrientation == TabOrientation.Vertical)
            {
                FocusRect.Height += CalcPageIndent(info, IndentType.Top);
                FocusRect.Y      -= ButtonsPanel.Bounds.Height;
                X = (infodes.Bounds.Width - PanelBounds.Width) / 2 + infodes.Bounds.X;
                Y = FocusRect.Bottom;
            }
            if (HeaderLocation == TabHeaderLocation.Right &&
                RealPageOrientation == TabOrientation.Horizontal)
            {
                FocusRect.Width += CalcPageIndent(info, IndentType.Top);
                FocusRect.Width -= ButtonsPanel.Bounds.Width;
                X = FocusRect.Right;
                Y = (infodes.Bounds.Height - PanelBounds.Height) / 2 + infodes.Bounds.Y;
            }
            if (HeaderLocation == TabHeaderLocation.Left &&
                RealPageOrientation == TabOrientation.Horizontal)
            {
                FocusRect.Width -= CalcPageIndent(info, IndentType.Top);
                FocusRect.Width -= ButtonsPanel.Bounds.Width;
                X = FocusRect.Right;
                Y = (infodes.Bounds.Height - PanelBounds.Height) / 2 + infodes.Bounds.Y;
            }
            if (HeaderLocation == TabHeaderLocation.Right &&
                (RealPageOrientation == TabOrientation.Default || RealPageOrientation == TabOrientation.Vertical))
            {
                FocusRect.Height += CalcPageIndent(info, IndentType.Right);
                FocusRect.Height -= ButtonsPanel.Bounds.Height;
                X = (infodes.Bounds.Width - PanelBounds.Width) / 2 + infodes.Bounds.X;
                Y = FocusRect.Bottom;
            }
            if (HeaderLocation == TabHeaderLocation.Left &&
                (RealPageOrientation == TabOrientation.Default || RealPageOrientation == TabOrientation.Vertical))
            {
                FocusRect.Height += CalcPageIndent(info, IndentType.Right);
                FocusRect.Height -= ButtonsPanel.Bounds.Height;
                FocusRect.Y      += ButtonsPanel.Bounds.Height;
                X = (infodes.Bounds.Width - PanelBounds.Width) / 2 + infodes.Bounds.X;
                Y = FocusRect.Top - ButtonsPanel.Bounds.Height;
            }
            PanelBounds         = new Rectangle(X, Y, PanelBounds.Width, PanelBounds.Height);
            ButtonsPanel.Bounds = PanelBounds;
            return(FocusRect);
        }
 public BaseTabPageViewInfoDescendant(IXtraTabPage page)
     : base(page)
 {
     _PagePanel = new TabButtonsPanelDescendant(ViewInfo, Page as XtraTabPageDescendant);
 }