Source: Creating Custom .NET Controls in C#, http://www.ondotnet.com/pub/a/dotnet/2002/03/18/customcontrols.html
System.Windows.Forms
and System.Drawing
.OnPaint()
code to new custom control:using System.Windows.Forms; using System.Drawing; namespace MyCustomControls { public class RoundButton : UserControl { public Color backgroundColor = Color.Blue; protected override void OnPaint(PaintEventArgs e) { Graphics graphics = e.Graphics; int penWidth = 4; Pen pen = new Pen(Color.Black, 4); int fontHeight = 10; Font font = new Font("Arial", fontHeight); SolidBrush brush = new SolidBrush(backgroundColor); graphics.FillEllipse(brush, 0, 0, Width, Height); SolidBrush textBrush = new SolidBrush(Color.Black); graphics.DrawEllipse(pen, (int) penWidth/2, (int) penWidth/2, Width - penWidth, Height - penWidth); graphics.DrawString(Text, font, textBrush, penWidth, Height / 2 - fontHeight); } } }