private static Padding ContentPaddingForButtonForm(Padding original,
ViewLayoutContext context,
int allocatedHeight)
{
// Get the krypton form that contains this control
KryptonForm kryptonForm = OwningKryptonForm(context.TopControl);
// Not interested if not inside a krypton form
if (kryptonForm != null)
{
// Get the padding just for the chrome borders
Padding chromeBorders = kryptonForm.RealWindowBorders;
// How much border space to allocate per button edge
int buttonBorder = (chromeBorders.Top - allocatedHeight - 10) / 2;
if (buttonBorder > 0)
return new Padding(buttonBorder);
else
return Padding.Empty;
}
return original;
}