ShellBrowserShowContextMenu Method (Point) |
Namespace: Jam.Shell
using (ShellBrowser lShellBrowser = new ShellBrowser(@"C:\Windows")) { lShellBrowser.ShowContextMenu(new System.Drawing.Point(100, 100)); }
using (ShellBrowser lShellBrowser = new ShellBrowser()) { lShellBrowser.Folder = @"C:\Pictures"; lShellBrowser.MultiObjects.Add("Image1.jpg"); lShellBrowser.MultiObjects.Add("Image2.jpg"); lShellBrowser.ShowContextMenu(new System.Drawing.Point(100, 100)); } ContextMenuStrip lAdditionalMenuItems = new ContextMenuStrip(); #region ShowContextMenu3 using (ShellBrowser lShellBrowser = new ShellBrowser(@"C:\Windows")) { lShellBrowser.ShowContextMenu(new System.Drawing.Point(100, 100), lAdditionalMenuItems); } #endregion ShowContextMenu3 #region InvokeContextMenuCommand using (ShellBrowser lShellBrowser = new ShellBrowser(@"C:\Windows")) { lShellBrowser.InvokeContextMenuCommand(ShellCommand.Properties); //Next line is compatible also. lShellBrowser.InvokeContextMenuCommand("properties"); } #endregion InvokeContextMenuCommand string lFilePath = @"c:\windows\explorer.exe"; #region BeforeShellCommand using (ShellBrowser shellBrowser = new ShellBrowser(lFilePath)) { //The following code shows some variants to stop a context menu item from being executed. shellBrowser.BeforeShellCommand += (s, e) => { if (e.Verb == ShellCommand.Open) e.Cancel = true; //this is equivalent to: if (e.Verb == ShellContextMenuCommand.Open) e.Cancel = true; //or if (ShellCommand.IsOpen(e.Verb)) e.Cancel = true; //not all context menu commands have a "verb". If it is empty, then you can at least access the caption: if (ShellCommand.IsEmpty(e.Verb)) System.Diagnostics.Debug.WriteLine(e.Verb.Caption); }; shellBrowser.ShowContextMenu(Cursor.Position); } #endregion BeforeShellCommand