/* * OnPaint */ /// <summary> /// Raises the <see cref="M:System.Windows.Forms.ButtonBase.OnPaint(System.Windows.Forms.PaintEventArgs)"></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; Rectangle bounds = this.ClientRectangle; /* Translate e.Graphics to render different scroll-button styles. */ switch (this.Style) { case NuGenScrollButtonStyle.Left: { bounds = new Rectangle(bounds.Top, bounds.Left, bounds.Height, bounds.Width); NuGenControlPaint.Make90CWGraphics(g, bounds); break; } case NuGenScrollButtonStyle.Right: { NuGenControlPaint.Make90CCWGraphics(g, bounds); bounds = new Rectangle(bounds.Top, bounds.Left, bounds.Height, bounds.Width); break; } case NuGenScrollButtonStyle.Up: { NuGenControlPaint.Make180CCWGraphics(g, bounds); break; } } if ( bounds.Width > 0 && bounds.Height > 0 ) { NuGenPaintParams paintParams = new NuGenPaintParams(g); paintParams.Bounds = bounds; paintParams.State = this.ButtonStateTracker.GetControlState(); if (this.DoubleArrow) { this.Renderer.DrawDoubleScrollButton(paintParams); } else { this.Renderer.DrawScrollButton(paintParams); } } }