I'm trying to draw a border around some controls in order to highlight them, but I'm getting unexpected behaviour, in that nothing is drawn.
Here is a current event method. I've tried a few variations.
private void checkBox1_Paint(object sender, PaintEventArgs e)
{
if (statechanged)
{
//Debug.WriteLine(checkBox1.Checked.ToString());
statechanged = false;
ControlPaint.DrawBorder(
e.Graphics,
RectangleToClient( new System.Drawing.Rectangle(checkBox1.Left -3,
checkBox1.Top -3,
checkBox1.ClientRectangle.Width + 6,
checkBox1.ClientRectangle.Height + 6)),
System.Drawing.Color.Red,
ButtonBorderStyle.Solid);
}
}
I'd appreciate any advice regarding what I might be doing wrong or missing.
Thank you for reading.