Support
Joined: 18 Jul 2005 Posts: 731
|
Posted: Wed Jun 18, 2008 9:45 am Post subject: HOWTO : Display a different context menu than the default system context menu. |
|
|
To display your own context menu (or context menu strip) instead of the default system context menu, use the PopupContextMenu event as follows :
[C# ]
private void fileView_PopupContextMenu(object sender, LogicNP.FileViewControl.PopupContextMenuEventArgs e)
{
// e.BackgroundMenu can be used to determine whether context menu is for item or background.
// This prevents FileView from displaying its own context menu
e.Cancel = true;
// Show your own menu(strip) instead
contextMenuStrip1.Show(Control.MousePosition);
}
[VB .Net]
Private Sub fileView_PopupContextMenu(ByVal sender As System.Object, ByVal e As LogicNP.FileViewControl.PopupContextMenuEventArgs) Handles fileView.PopupContextMenu
' e.BackgroundMenu can be used to determine whether context menu is for item or background.
' This prevents FileView from displaying its own context menu
e.Cancel = true
' Show your own menu(strip) instead
contextMenuStrip1.Show(Control.MousePosition)
End Sub |
|