Exemple #1
0
        /// <summary>
        /// Handles the <see cref="E:RenderButtonBackground" /> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.ToolStripRenderEventArgs" /> that contains the event data.</param>
        protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
        {
            ZeroitTabStrip tabStrip = e.ToolStrip as ZeroitTabStrip;
            Tab            tab      = e.Item as Tab;
            Rectangle      bounds   = new Rectangle(Point.Empty, e.Item.Size);

            if (tab != null && tabStrip != null)
            {
                System.Windows.Forms.VisualStyles.TabItemState tabState = System.Windows.Forms.VisualStyles.TabItemState.Normal;
                if (tab.Checked)
                {
                    tabState |= System.Windows.Forms.VisualStyles.TabItemState.Selected;
                }
                if (tab.Selected)
                {
                    tabState |= System.Windows.Forms.VisualStyles.TabItemState.Hot;
                }
                TabRenderer.DrawTabItem(e.Graphics, bounds, tabState);
            }
            else
            {
                base.OnRenderButtonBackground(e);
            }
        }
 public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, bool focused, System.Windows.Forms.VisualStyles.TabItemState state)
 {
 }
 public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string tabItemText, System.Drawing.Font font, TextFormatFlags flags, System.Drawing.Image image, System.Drawing.Rectangle imageRectangle, bool focused, System.Windows.Forms.VisualStyles.TabItemState state)
 {
 }
 public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string tabItemText, System.Drawing.Font font, System.Windows.Forms.VisualStyles.TabItemState state)
 {
 }
Exemple #5
0
        private void _Draw_Tabs(Graphics g)
        {
            int       i             = 0;
            Rectangle bounds_intern = GetTabRectangle(0);

            switch (Tab_Renderer.Mode)
            {
            case VisualTabRenderer_Mode.NO_PREFERENCE:

                foreach (VisualTabPage p in this._Tabs)
                {
                    bounds_intern = GetTabRectangle(i);

                    if (bounds_intern.X > TabBarBoundsWithButtons.Width + TabBarBoundsWithButtons.X)
                    {
                        break;
                    }
                    System.Windows.Forms.VisualStyles.TabItemState state = System.Windows.Forms.VisualStyles.TabItemState.Normal;

                    if (IsSelected(p))
                    {
                        state = System.Windows.Forms.VisualStyles.TabItemState.Selected;
                    }
                    else if (bounds_intern.Contains(Mouse_Moving))
                    {
                        state = System.Windows.Forms.VisualStyles.TabItemState.Hot;
                    }
                    Tab_Renderer.DrawTabItem(g, bounds_intern, state);
                    g.DrawString(p.Text, this.Font, SystemBrushes.ControlText, Tab_Renderer.GetTextBounds(bounds_intern));


                    i++;
                }
                break;

            case VisualTabRenderer_Mode.SELECTED_LAST:
                foreach (VisualTabPage p in this._Tabs)
                {
                    if (IsSelected(p))
                    {
                        i++;
                        continue;
                    }
                    bounds_intern = GetTabRectangle(i);

                    if (bounds_intern.X > TabBarBounds.Width + TabBarBounds.X)
                    {
                        break;
                    }
                    System.Windows.Forms.VisualStyles.TabItemState state = System.Windows.Forms.VisualStyles.TabItemState.Normal;

                    if (bounds_intern.Contains(Mouse_Moving))
                    {
                        state = System.Windows.Forms.VisualStyles.TabItemState.Hot;
                    }


                    Tab_Renderer.DrawTabItem(g, bounds_intern, state);
                    g.DrawString(p.Text, this.Font, SystemBrushes.ControlText, Tab_Renderer.GetTextBounds(bounds_intern));

                    i++;
                }
                i = 0;

                foreach (VisualTabPage p in this._Tabs)
                {
                    if (!IsSelected(p))
                    {
                        i++;

                        continue;
                    }
                    bounds_intern = GetTabRectangle(i);
                    if (bounds_intern.X > TabBarBounds.Width + TabBarBounds.X)
                    {
                        break;
                    }
                    System.Windows.Forms.VisualStyles.TabItemState state = System.Windows.Forms.VisualStyles.TabItemState.Selected;


                    Tab_Renderer.DrawTabItem(g, bounds_intern, state);
                    g.DrawString(p.Text, this.Font, SystemBrushes.ControlText, Tab_Renderer.GetTextBounds(bounds_intern));

                    break;
                }
                //MessageBox.Show("Selected tab: " + i + " , " + this.SelectedTabIndex);
                break;

            case VisualTabRenderer_Mode.SELECTED_FIRST:

                foreach (VisualTabPage p in this._Tabs)
                {
                    bounds_intern = GetTabRectangle(i);
                    if (!IsSelected(p))
                    {
                        bounds_intern = Tab_Renderer.GetOffsetBounds(bounds_intern, i - 1);
                        i++;
                        continue;
                    }

                    System.Windows.Forms.VisualStyles.TabItemState state = System.Windows.Forms.VisualStyles.TabItemState.Selected;


                    Tab_Renderer.DrawTabItem(g, bounds_intern, state);

                    g.DrawString(p.Text, this.Font, SystemBrushes.ControlText, Tab_Renderer.GetTextBounds(bounds_intern));

                    i++;
                }
                i             = 0;
                bounds_intern = GetTabRectangle(0);
                foreach (VisualTabPage p in this._Tabs)
                {
                    if (IsSelected(p))
                    {
                        i++;
                        continue;
                    }
                    bounds_intern = GetTabRectangle(i);

                    System.Windows.Forms.VisualStyles.TabItemState state = System.Windows.Forms.VisualStyles.TabItemState.Normal;

                    if (bounds_intern.Contains(Mouse_Moving))
                    {
                        state = System.Windows.Forms.VisualStyles.TabItemState.Hot;
                    }

                    Tab_Renderer.DrawTabItem(g, bounds_intern, state);
                    g.DrawString(p.Text, this.Font, SystemBrushes.ControlText, Tab_Renderer.GetTextBounds(bounds_intern));

                    i++;
                }
                break;
            }
        }