public void ShowSubMenu(bool keyboardActivated)
{
// Only need to show if not already doing so
if ((_contextMenu == null) || (_contextMenu.IsDisposed))
{
// No need for the sub menu timer anymore, we are showing
_provider.ProviderViewManager.SetTargetSubMenu((IContextMenuTarget)KeyController);
// Only show a sub menu if there is one to be shown!
if (HasSubMenu)
{
// Create the actual control used to show the context menu
_contextMenu = new VisualContextMenu(_provider, _menuItem.Items, keyboardActivated);
// Need to know when the visual control is removed
_contextMenu.Disposed += new EventHandler(OnContextMenuDisposed);
// Get the screen rectangle for the drawing element
Rectangle menuDrawRect = this.OwningControl.RectangleToScreen(ClientRectangle);
// Should this menu item be shown at a fixed screen rectangle?
if (_provider.ProviderShowSubMenuFixed(_menuItem))
{
// Request the menu be shown at fixed screen rectangle
_contextMenu.ShowFixed(_provider.ProviderShowSubMenuFixedRect(_menuItem),
_provider.ProviderShowHorz,
_provider.ProviderShowVert);
}
else
{
// Request the menu be shown immediately
_contextMenu.Show(menuDrawRect,
_provider.ProviderShowHorz,
_provider.ProviderShowVert,
true, false);
}
}
}
}