/* * 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; Rectangle radioBounds = Rectangle.Empty; ContentAlignment radioAlign = this.CheckAlign; NuGenRadioButtonPaintParams paintParams = new NuGenRadioButtonPaintParams(g); paintParams.Bounds = radioBounds = this.LayoutManager.GetRadioButtonBounds( new NuGenBoundsParams( bounds , radioAlign , new Rectangle(Point.Empty, this.LayoutManager.GetRadioSize()) , this.RightToLeft ) ); paintParams.Checked = this.Checked; paintParams.State = this.ButtonStateTracker.GetControlState(); this.Renderer.DrawRadioButton(paintParams); radioBounds.Inflate(3, 3); NuGenTextPaintParams textPaintParams = new NuGenTextPaintParams(paintParams); textPaintParams.Bounds = this.LayoutManager.GetTextBounds( new NuGenBoundsParams(bounds, radioAlign, radioBounds, this.RightToLeft) ); textPaintParams.Font = this.Font; textPaintParams.ForeColor = this.ForeColor; textPaintParams.Text = this.Text; textPaintParams.TextAlign = NuGenControlPaint.RTLContentAlignment(this.TextAlign, this.RightToLeft); textPaintParams.State = this.StateTracker.GetControlState(); this.Renderer.DrawText(textPaintParams); }
/* * DrawRadioButton */ /// <summary> /// </summary> /// <param name="paintParams"></param> /// <exception cref="ArgumentNullException"> /// <para><paramref name="paintParams"/> is <see langword="null"/>.</para> /// </exception> public void DrawRadioButton(NuGenRadioButtonPaintParams paintParams) { if (paintParams == null) { throw new ArgumentNullException("paintParams"); } Graphics g = paintParams.Graphics; Rectangle bounds = paintParams.Bounds; NuGenControlState state = paintParams.State; this.DrawEllipseBackground(g, bounds, state); using (NuGenGrfxMode mode = new NuGenGrfxMode(g)) { g.SmoothingMode = SmoothingMode.AntiAlias; this.DrawEllipseBorder(g, bounds, state); } if (paintParams.Checked) { this.DrawRadio(g, bounds, state); } }
public void DrawRadioButton(NuGenRadioButtonPaintParams paintParams) { Assert.IsNotNull(paintParams); }