/* * OnPaint */ /// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.Paint"></see> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs"></see> that contains the event data.</param> protected override void OnPaint(PaintEventArgs e) { Graphics g = e.Graphics; using (SolidBrush sb = new SolidBrush(this.BackColor)) { g.FillRectangle(sb, this.ClientRectangle); } Rectangle closeButtonBounds = this.CloseButton.Visible ? this.CloseButton.Bounds : Rectangle.Empty; Rectangle bounds = this.LayoutManager.GetContentRectangle(this.ClientRectangle, closeButtonBounds); Image image = this.Image; System.Drawing.ContentAlignment imageAlign = System.Drawing.ContentAlignment.MiddleLeft; Rectangle imageBounds = Rectangle.Empty; if (image != null) { imageBounds = this.LayoutManager.GetImageBounds( new NuGenBoundsParams( bounds , imageAlign , new Rectangle(Point.Empty, image.Size) , this.RightToLeft ) ); } Rectangle textBounds = this.LayoutManager.GetTextBounds( new NuGenBoundsParams(bounds, imageAlign, imageBounds, this.RightToLeft) ); NuGenTabButtonPaintParams tabItemParams = new NuGenTabButtonPaintParams(g); tabItemParams.Bounds = this.ClientRectangle; tabItemParams.Font = this.Font; tabItemParams.Image = this.Image; tabItemParams.ImageBounds = imageBounds; tabItemParams.Text = this.Text; if (this.Text != null) { tabItemParams.TextBounds = textBounds; } tabItemParams.State = NuGenTabItemStateTranslator.FromControlState(this.TabStateTracker.GetControlState()); Debug.Assert(this.TabRenderer != null, "this.TabRenderer != null"); this.TabRenderer.DrawTabButton(tabItemParams); }
private NuGenControlState GetControlState(TabItemState tabItemState) { return(NuGenTabItemStateTranslator.ToControlState(tabItemState)); }
private TabItemState GetTabItemState(NuGenControlState ctrlState) { return(NuGenTabItemStateTranslator.FromControlState(ctrlState)); }