private Rectangle GetTabRectangle(int index) { Rectangle r = new Rectangle(new Point((index - 1) * TabSize.Width - ScrollLocation, 0), TabSize); r = Tab_Renderer.GetOffsetBounds(r, index); r = new Rectangle(1 + Tab_Renderer.Margins.Left + r.X, 1 + Tab_Renderer.Margins.Top + r.Y, r.Width, r.Height); return(r); }
private Rectangle GetTabRectangle(int index, bool raw) { if (!raw) { return(GetTabRectangle(index)); } Rectangle r = new Rectangle(new Point((index - 1) * TabSize.Width, 0), TabSize); r = Tab_Renderer.GetOffsetBounds(r, index); r = new Rectangle(1 + Tab_Renderer.Margins.Left + r.X, 1 + Tab_Renderer.Margins.Top + r.Y, r.Width, r.Height); return(r); }
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; } }