I have a winforms app which I have placed my own custom labels on using the following class
public class LabelWithBorder : Label
{
protected override void OnPaint(PaintEventArgs e)
{
ColorMe(e);
}
private void ColorMe(PaintEventArgs e)
{
Color myColor = Color.FromArgb(104, 195, 198);
Pen myPen = new Pen(myColor, 1);
e.Graphics.DrawRectangle(myPen,
e.ClipRectangle.Left,
e.ClipRectangle.Top,
e.ClipRectangle.Width - 1,
e.ClipRectangle.Height - 1);
base.OnPaint(e);
}
}
The resultant LabelWithBorder simply has a border with colors to match my clients own literature / website etc. The picture below shows (on the left) how it should / and does initially look like.
However the issue I have, is that whenever one window is dragged over another, the labels become distorted as per the picture on the right.

Can anyone advice what is causing this distortion and how I should rectify it.
This works and code is simple: