private void PaintTransparentBackground(PaintEventArgs e)
{
// Get the parent control for transparent drawing purposes
Control parent = TransparentParent;
// Do we have a parent control and we need to paint background?
if ((parent != null) && NeedTransparentPaint)
{
// 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[] { e, ClientRectangle, null });
}
else
{
// Request the background be painted in the system colors
PaintBackground(e.Graphics, SystemBrushes.Control, ClientRectangle);
}
}