public void ContextMenuPopup(object sender, EventArgs e)
{
// Update the menu state before displaying it
OutlookBarBand band = bands[currentBandIndex];
MenuItemEx largeIconsMenu = (MenuItemEx)ContextMenu.MenuItems[0];
MenuItemEx smallIconsMenu = (MenuItemEx)ContextMenu.MenuItems[1];
MenuItemEx renameGroup = (MenuItemEx)ContextMenu.MenuItems[3];
MenuItemEx renameShortcut = (MenuItemEx)ContextMenu.MenuItems[5];
int index;
HitTestType hit = HitTest(lastClickedPoint, out index, false);
if ( hit == HitTestType.Header )
{
renameGroup.Enabled = true;
largeIconsMenu.Enabled = false;
smallIconsMenu.Enabled = false;
renameShortcut.Enabled = false;
}
else if ( hit == HitTestType.Item )
{
renameGroup.Enabled = false;
largeIconsMenu.Enabled = false;
smallIconsMenu.Enabled = false;
renameShortcut.Enabled = true;
}
else
{
renameGroup.Enabled = false;
largeIconsMenu.Enabled = true;
smallIconsMenu.Enabled = true;
renameShortcut.Enabled = false;
}
if ( HasChild() )
{
largeIconsMenu.RadioCheck = false;
smallIconsMenu.RadioCheck = false;
}
else
{
largeIconsMenu.RadioCheck = (band.IconView == IconView.Large);
smallIconsMenu.RadioCheck = (band.IconView == IconView.Small);
}
}