C# 클래스 BExplorer.Shell.ShellContextMenu

Provides support for displaying the context menu of a shell item.

Use this class to display a context menu for a shell item, either as a popup menu, or as a main menu.

To display a popup menu, simply call ShowContextMenu(...)/> with the parent control and the position at which the menu should be shown.

To display a shell context menu in a Form's main menu, call the Populate method to populate the menu. In addition, you must intercept a number of special messages that will be sent to the menu's parent form. To do this, you must override Form.WndProc like so:

protected override void WndProc(ref Message m) { if ((m_ContextMenu == null) || (!m_ContextMenu.HandleMenuMessage(ref m))) { base.WndProc(ref m); } }

Where m_ContextMenu is the ShellContextMenu being shown.

Standard menu commands can also be invoked from this class, for example InvokeDelete and InvokeRename.
파일 보기 프로젝트 열기: Gainedge/BetterExplorer 1 사용 예제들

Private Properties

프로퍼티 타입 설명
GenerateExplorerBackgroundMenuItems void
GenerateMenuItem void
GenerateMenuItemExecutable void
GenerateSeparator void
GenerateSubmenu void
GetNewContextMenuItems List
Initialize void
InvokeCommand void
RemoveDefaultExplorerItems void
RemoveDuplicatedSeparators void
RemoveShellMenuItems void
TagManagedMenuItems void

공개 메소드들

메소드 설명
GetNewContextMenu ( IListItemEx item, IntPtr &iContextMenuPtr, IContextMenu &iContextMenu ) : bool
GetOpenWithContextMenu ( IListItemEx itemArray, IntPtr &iContextMenuPtr, IContextMenu &iContextMenu ) : bool
HandleMenuMessage ( Message &m ) : bool

Handles context menu messages when the ShellContextMenu is displayed on a Form's main menu bar.

To display a shell context menu in a Form's main menu, call the Populate method to populate the menu with the shell item's menu items. In addition, you must intercept a number of special messages that will be sent to the menu's parent form. To do this, you must override Form.WndProc like so:

protected override void WndProc(ref Message m) { if ((m_ContextMenu == null) || (!m_ContextMenu.HandleMenuMessage(ref m))) { base.WndProc(ref m); } }

Where m_ContextMenu is the ShellContextMenu being shown.

Populate ( Menu menu, CMF additionalFlags ) : void

Populates a Menu with the context menu items for a shell item.

If this method is being used to populate a Form's main menu then you need to call HandleMenuMessage in the Form's message handler.

ShellContextMenu ( IListItemEx items, SVGIO svgio = SVGIO.SVGIO_SELECTION, ShellView view = null ) : System

Initializes a new instance of the ShellContextMenu class.

ShellContextMenu ( ShellView shellView, IListItemEx item ) : System

Initializes a new instance of the ShellContextMenu class.

ShellContextMenu ( ShellView shellView, bool Use_GetNewContextMenu ) : System

Initializes a new instance of the ShellContextMenu class.

ShowContextMenu ( Point pos, int type, System.Boolean shouldShow = true ) : int
ShowContextMenu ( Control control, Point pos, CMF aditionalFlags, bool IsOnEmpty = false ) : void

Shows a context menu for a shell item.

비공개 메소드들

메소드 설명
GenerateExplorerBackgroundMenuItems ( ContextMenu view, ContextMenu mnu, ContextMenu sortMenu, ContextMenu groupMenu ) : void
GenerateMenuItem ( ContextMenu view, String header, int id, bool isRadio = false, uint atPosition ) : void
GenerateMenuItemExecutable ( ContextMenu view, String header, int id ) : void
GenerateSeparator ( ContextMenu view ) : void
GenerateSubmenu ( ContextMenu child, ContextMenu parent, String header ) : void
GetNewContextMenuItems ( ) : List
Initialize ( IListItemEx items ) : void
InvokeCommand ( IntPtr command, Point pt, IntPtr ansiCommand ) : void
RemoveDefaultExplorerItems ( ContextMenu mnu, Control control, MENUITEMINFO &itemInfo ) : void
RemoveDuplicatedSeparators ( ContextMenu mnu ) : void
RemoveShellMenuItems ( Menu menu ) : void
TagManagedMenuItems ( Menu menu, int tag ) : void

메소드 상세

GetNewContextMenu() 공개 메소드

public GetNewContextMenu ( IListItemEx item, IntPtr &iContextMenuPtr, IContextMenu &iContextMenu ) : bool
item IListItemEx
iContextMenuPtr System.IntPtr
iContextMenu IContextMenu
리턴 bool

GetOpenWithContextMenu() 공개 메소드

public GetOpenWithContextMenu ( IListItemEx itemArray, IntPtr &iContextMenuPtr, IContextMenu &iContextMenu ) : bool
itemArray IListItemEx
iContextMenuPtr System.IntPtr
iContextMenu IContextMenu
리턴 bool

HandleMenuMessage() 공개 메소드

Handles context menu messages when the ShellContextMenu is displayed on a Form's main menu bar.

To display a shell context menu in a Form's main menu, call the Populate method to populate the menu with the shell item's menu items. In addition, you must intercept a number of special messages that will be sent to the menu's parent form. To do this, you must override Form.WndProc like so:

protected override void WndProc(ref Message m) { if ((m_ContextMenu == null) || (!m_ContextMenu.HandleMenuMessage(ref m))) { base.WndProc(ref m); } }

Where m_ContextMenu is the ShellContextMenu being shown.

public HandleMenuMessage ( Message &m ) : bool
m System.Windows.Forms.Message /// The message to handle. ///
리턴 bool

Populate() 공개 메소드

Populates a Menu with the context menu items for a shell item.
If this method is being used to populate a Form's main menu then you need to call HandleMenuMessage in the Form's message handler.
public Populate ( Menu menu, CMF additionalFlags ) : void
menu System.Windows.Forms.Menu The menu to populate.
additionalFlags CMF
리턴 void

ShellContextMenu() 공개 메소드

Initializes a new instance of the ShellContextMenu class.
public ShellContextMenu ( IListItemEx items, SVGIO svgio = SVGIO.SVGIO_SELECTION, ShellView view = null ) : System
items IListItemEx /// The items to which the context menu should refer. ///
svgio SVGIO
view ShellView The ShellView the ContextMenu is associated with
리턴 System

ShellContextMenu() 공개 메소드

Initializes a new instance of the ShellContextMenu class.
public ShellContextMenu ( ShellView shellView, IListItemEx item ) : System
shellView ShellView The ShellView for this context menu
item IListItemEx /// The item to which the context menu should refer. ///
리턴 System

ShellContextMenu() 공개 메소드

Initializes a new instance of the ShellContextMenu class.
public ShellContextMenu ( ShellView shellView, bool Use_GetNewContextMenu ) : System
shellView ShellView The ShellView the ContextMenu is associated with
Use_GetNewContextMenu bool
리턴 System

ShowContextMenu() 공개 메소드

public ShowContextMenu ( Point pos, int type, System.Boolean shouldShow = true ) : int
pos Point
type int
shouldShow System.Boolean
리턴 int

ShowContextMenu() 공개 메소드

Shows a context menu for a shell item.
public ShowContextMenu ( Control control, Point pos, CMF aditionalFlags, bool IsOnEmpty = false ) : void
control System.Windows.Forms.Control /// The parent control. ///
pos Point /// The position on that the menu /// should be displayed at. ///
aditionalFlags CMF
IsOnEmpty bool
리턴 void