protected override void OnLayout(LayoutEventArgs levent)
{
// Let base class calulcate fill rectangle
base.OnLayout(levent);
// Need a render context for accessing the renderer
using (RenderContext context = new RenderContext(this, null, ClientRectangle, Renderer))
{
// Grab a path that is the outside edge of the border
Rectangle borderRect = ClientRectangle;
GraphicsPath borderPath1 = Renderer.RenderStandardBorder.GetOutsideBorderPath(context, borderRect, _provider.ProviderStateCommon.ControlOuter.Border, VisualOrientation.Top, PaletteState.Normal);
borderRect.Inflate(-1, -1);
GraphicsPath borderPath2 = Renderer.RenderStandardBorder.GetOutsideBorderPath(context, borderRect, _provider.ProviderStateCommon.ControlOuter.Border, VisualOrientation.Top, PaletteState.Normal);
borderRect.Inflate(-1, -1);
GraphicsPath borderPath3 = Renderer.RenderStandardBorder.GetOutsideBorderPath(context, borderRect, _provider.ProviderStateCommon.ControlOuter.Border, VisualOrientation.Top, PaletteState.Normal);
// Update the region of the popup to be the border path
Region = new Region(borderPath1);
// Inform the shadow to use the same paths for drawing the shadow
DefineShadowPaths(borderPath1, borderPath2, borderPath3);
}
}