protected override void OnLayout(LayoutEventArgs levent)
{
// Let base class calulcate fill rectangle
base.OnLayout(levent);
// Ribbon shape determines the border rounding required
int borderRounding;
switch (_ribbon.RibbonShape)
{
default:
case PaletteRibbonShape.Office2007:
borderRounding = 2;
break;
case PaletteRibbonShape.Office2010:
borderRounding = 1;
break;
}
// Update the region of the popup to be the border path
using (GraphicsPath roundPath = CommonHelper.RoundedRectanglePath(ClientRectangle, borderRounding))
Region = new Region(roundPath);
}