Ejemplo n.º 1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            Graphics g = e.Graphics;

            RefreshTabSize(g);

            if (_Tabs.Count > 0)
            {
                _Draw_Tabs(g);
            }
            // Draw close button.
            if (Draw_Close)
            {
                System.Windows.Forms.VisualStyles.PushButtonState state = System.Windows.Forms.VisualStyles.PushButtonState.Normal;
                if (Tab_Renderer.HitsCloseButton(Mouse_Moving, TabBarBounds))
                {
                    state = System.Windows.Forms.VisualStyles.PushButtonState.Hot;
                }
                if (Tab_Renderer.HitsCloseButton(Mouse_Holding, TabBarBounds))
                {
                    state = System.Windows.Forms.VisualStyles.PushButtonState.Pressed;
                }
                if (!Can_Close)
                {
                    state = System.Windows.Forms.VisualStyles.PushButtonState.Disabled;
                }
                Tab_Renderer.DrawCloseButton(g, TabBarBounds, state);
            }

            Tab_Renderer.DrawScrollButtons(g, TabBarBounds, Mouse_Moving, Mouse_Holding, (Draw_Close), Overflow);

            // Top
            g.FillRectangle(SystemBrushes.Control, new Rectangle(0, 0, this.Size.Width, Padding.Top - TabBarBounds.Height));

            // Left
            g.FillRectangle(SystemBrushes.Control, new Rectangle(0, 0, Padding.Left, this.Size.Height));

            // Right
            g.FillRectangle(SystemBrushes.Control, new Rectangle(this.Size.Width - Padding.Right, 0, this.Size.Width, this.Size.Height));

            // Bottom
            g.FillRectangle(SystemBrushes.Control, new Rectangle(0, this.Size.Height - Padding.Bottom, this.Size.Width, this.Size.Height));
        }
Ejemplo n.º 2
0
        private VisualTab_HitTest HitTest(Point p)
        {
            VisualTab_HitTest test = new VisualTab_HitTest();

            for (int i = 0; i < this.Tabs.Count; i++)
            {
                Rectangle tab_re = this.GetTabRectangle(i);

                if (tab_re.Contains(p))
                {
                    test.Tab      = i;
                    test.Location = VisualTab_HitLocation.Tab;
                    break;
                }
            }
            if (Tab_Renderer.ArrowLeft.Contains(p))
            {
                test.Location = VisualTab_HitLocation.Scroll_left;
            }
            if (Tab_Renderer.ArrowRight.Contains(p))
            {
                test.Location = VisualTab_HitLocation.Scroll_right;
            }
            if (Draw_Close)
            {
                if (Tab_Renderer.HitsCloseButton(p, TabBarBounds))
                {
                    test.Location = VisualTab_HitLocation.Close;
                }
            }
            if (WillDraw_Dropdown)
            {
            }

            return(test);
        }