protected override void OnPaintBackground(PaintEventArgs pevent)
{
// Do we have a parent control and we need to paint background?
if (Parent != null)
{
// Only grab the required reference once
if (_miPTB == null)
{
// Use reflection so we can call the Windows Forms internal method for painting parent background
_miPTB = typeof(Control).GetMethod("PaintTransparentBackground",
BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod,
null, CallingConventions.HasThis,
new Type[] { typeof(PaintEventArgs), typeof(Rectangle), typeof(Region) },
null);
}
_miPTB.Invoke(this, new object[] { pevent, ClientRectangle, null });
}
else
base.OnPaintBackground(pevent);
}