protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); float totalLength = e.ClipRectangle.Right - e.ClipRectangle.Left; float quaterLength = ((totalLength / 2) / 4); int startPoint = (int)(e.ClipRectangle.Left + 10); Rectangle rectAngle = new Rectangle(e.ClipRectangle.X, e.ClipRectangle.Y - 1, e.ClipRectangle.Width, e.ClipRectangle.Height); rectAngle.X = startPoint + CheckBoxRenderer.GetGlyphSize(e.Graphics, CheckBoxState.UncheckedNormal).Width; SizeF sizeF = e.Graphics.MeasureString(Text, this.Font); rectAngle.Width = (int)sizeF.Width + 2; rectAngle.Height = this.Font.Height; CheckBoxRenderer.RenderMatchingApplicationState = true; Rectangle rectAngleBack = new Rectangle(startPoint - 3, rectAngle.Y, (rectAngle.X - (startPoint - 3)) + rectAngle.Width, rectAngle.Height); RadioButtonRenderer.DrawParentBackground(e.Graphics, rectAngleBack, this); Font font = Font; RadioButtonRenderer.DrawRadioButton(e.Graphics, new System.Drawing.Point(startPoint, e.ClipRectangle.Y), rectAngle, Text, this.Font, TextFormatFlags.VerticalCenter, false, checkedStatus ? RadioButtonState.CheckedNormal: RadioButtonState.UncheckedNormal); }
protected override void OnPaintBackground(PaintEventArgs p) { if (innerbgbuffer != null) { innerbgbuffer.Graphics.Clear(this.BackColor); if (this.BackgroundImage != null || Parent == null) { base.OnPaintBackground(new PaintEventArgs(innerbgbuffer.Graphics, p.ClipRectangle)); } else { RadioButtonRenderer.DrawParentBackground(innerbgbuffer.Graphics, p.ClipRectangle, this); } p.Graphics.DrawImage(innerbgbuffer.Bitmap, p.ClipRectangle, p.ClipRectangle, GraphicsUnit.Pixel); } else { base.OnPaintBackground(p); if (this.BackColor == Color.Transparent && Parent != null) { RadioButtonRenderer.DrawParentBackground(p.Graphics, p.ClipRectangle, this); } } }