ShellBrowserShowContextMenu Method (Point, ContextMenuStrip) |
Shows the shell context menu for the files contained in
MultiObjects or the active object, adding the context menu
entries contained in
pContextMenuStrip
Namespace:
Jam.Shell
Assembly:
ShellBrowser.Winforms (in ShellBrowser.Winforms.dll) Version: 6.3.1
Syntax public string ShowContextMenu(
Point pPosition,
ContextMenuStrip pContextMenuStrip
)
Public Function ShowContextMenu (
pPosition As Point,
pContextMenuStrip As ContextMenuStrip
) As String
public:
String^ ShowContextMenu(
Point pPosition,
ContextMenuStrip^ pContextMenuStrip
)
member ShowContextMenu :
pPosition : Point *
pContextMenuStrip : ContextMenuStrip -> string
Parameters
- pPosition
- Type: System.DrawingPoint
Position on the screen at which the context menu should appear. - pContextMenuStrip
- Type: System.Windows.FormsContextMenuStrip
ContextMenuStrip that should be merged with the shell context
menu, or (ContextMenuStrip)null if there is no ContextMenuStrip to merge.
Return Value
Type:
String
The shell command that was executed, an empty string if no shell command was executed.
Examples
Showing the context menu for the Windows folder and adding additional menu items from the passed ContextMenuStrip
using (ShellBrowser lShellBrowser = new ShellBrowser(@"C:\Windows"))
{
lShellBrowser.ShowContextMenu(new System.Drawing.Point(100, 100), lAdditionalMenuItems);
}
Examples
Shows the usage of the
BeforeShellCommand event.
using (ShellBrowser shellBrowser = new ShellBrowser(lFilePath))
{
shellBrowser.BeforeShellCommand += (s, e) =>
{
if (e.Verb == ShellCommand.Open)
e.Cancel = true;
if (e.Verb == ShellContextMenuCommand.Open)
e.Cancel = true;
if (ShellCommand.IsOpen(e.Verb))
e.Cancel = true;
if (ShellCommand.IsEmpty(e.Verb))
System.Diagnostics.Debug.WriteLine(e.Verb.Caption);
};
shellBrowser.ShowContextMenu(Cursor.Position);
}
See Also