public override int CalcMenuBarSize (Graphics dc, Menu menu, int width)
{
int x = 0;
int y = 0;
menu.Height = 0;
foreach (MenuItem item in menu.MenuItems) {
CalcItemSize (dc, item, y, x, true);
if (x + item.Width > width) {
item.X = 0;
y += item.Height;
item.Y = y;
x = 0;
}
x += item.Width;
item.MenuBar = true;
if (y + item.Height > menu.Height)
menu.Height = item.Height + y;
}
menu.Width = width;
return menu.Height;
}