I would like to override System.Windows.Forms.UserControl to draw a custom border (e.g. using custom color). It's not possiblу to do usign built-in classes, because the only method/property you can affect the border behavior is BorderStyle.
Overriding OnPaint the following way (code below) is not a good solution, because it's basically drawing another border on top of original one.
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (this.BorderStyle == BorderStyle.FixedSingle)
ControlPaint.DrawBorder(e.Graphics, this.ClientRectangle, Color.LightGray, ButtonBorderStyle.Solid);
}
Does anyone know how to override border drawing in custom control?
Putting this user control into a panel is not an option in my case for certain reasons.