バージョン

ContextMenuBaseEventArgs クラス

ContextMenu を含むキャンセル可能なイベントの抽象基本イベント引数クラス。
シンタックス
'宣言
 
Public MustInherit Class ContextMenuBaseEventArgs 
   Inherits System.ComponentModel.CancelEventArgs
public abstract class ContextMenuBaseEventArgs : System.ComponentModel.CancelEventArgs 
使用例
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinTabs
Imports Infragistics.Win.UltraWinTabbedMdi

Private WithEvents customMenuItem As Infragistics.Win.IGControls.IGMenuItem = Nothing

Private Sub OnCustomMenuItem(ByVal sender As Object, ByVal e As EventArgs)
    Dim mi As Infragistics.Win.IGControls.IGMenuItem = CType(sender, Infragistics.Win.IGControls.IGMenuItem)

    ' do some custom action...
End Sub

Private Sub ultraTabbedMdiManager1_InitializeContextMenu(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTabbedMdi.MdiTabContextMenuEventArgs) Handles ultraTabbedMdiManager1.InitializeContextMenu
    ' Setting the Cancel parameter to true will prevent the 
    ' context menu from being displayed.
    '
    'e.Cancel = True

    ' the 'ContextMenuType' indicates the reason for which 
    ' the context menu is being displayed.
    '
    If e.ContextMenuType = MdiTabContextMenu.Default Then
        ' the 'Default' type indicates that the user right clicked
        ' on the tab
        '

        ' the 'Tab' parameter indicates the tab for which 
        ' the context menu is being displayed
        '
        If True Then
            If Me.customMenuItem Is Nothing Then
                ' items added to the context menu should be
                ' of type IGMenuItem so they can be owner drawn
                ' using the appropriate style being used by 
                ' the context menu
                Me.customMenuItem = New Infragistics.Win.IGControls.IGMenuItem("Perform Custom Action")
                AddHandler Me.customMenuItem.Click, New EventHandler(AddressOf Me.OnCustomMenuItem)

                ' the Image property of the IGMenuItem can
                ' be used to specify your own menu item. the
                ' image may be from a file or an integer
                ' indicating the index of the image in the
                ' tabbed mdi manager's ImageList
                'Me.customMenuItem.Image = Image.FromFile("C:\menuItemImage.bmp")
                Me.customMenuItem.Image = 0
            End If

            ' the 'ContextMenu' parameter can be used to manipulate
            ' the default menu items or add your own
            e.ContextMenu.MenuItems.Add(Me.customMenuItem)
        End If
    ElseIf e.ContextMenuType = MdiTabContextMenu.Reposition Then
        ' A ContextMenuType of Reposition is used when the user
        ' drags a tab into an area within the mdi client but
        ' not on a tab group control.
        '

        ' Items in the specified 'ContextMenu' parameter may be 
        ' manipulated.
        '
        Dim item As MenuItem
        For Each item In e.ContextMenu.MenuItems
            ' the GetMenuType method can be used to determine
            ' the action associated with a particular menu
            ' item
            Select Case e.GetMenuType(item)
                Case MdiTabMenuItems.Cancel
                Case MdiTabMenuItems.CancelSeparator
                    ' we'll hide the cancel and cancel separator.
                    ' Note: if all the menu items are hidden
                    ' no context menu will be displayed
                    '
                    item.Visible = False
                    Exit For
            End Select
        Next
    End If
End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinTabs;
using Infragistics.Win.UltraWinTabbedMdi;

private Infragistics.Win.IGControls.IGMenuItem customMenuItem = null;

private void OnCustomMenuItem( object sender, EventArgs e )
{
	Infragistics.Win.IGControls.IGMenuItem mi = sender as Infragistics.Win.IGControls.IGMenuItem;

	// do some custom action...
}

private void ultraTabbedMdiManager1_InitializeContextMenu(object sender, Infragistics.Win.UltraWinTabbedMdi.MdiTabContextMenuEventArgs e)
{
	// Setting the Cancel parameter to true will prevent the 
	// context menu from being displayed.
	//
	//e.Cancel = true;

	// the 'ContextMenuType' indicates the reason for which 
	// the context menu is being displayed.
	//
	if (e.ContextMenuType == MdiTabContextMenu.Default)
	{
		// the 'Default' type indicates that the user right clicked
		// on the tab
		//

		// the 'Tab' parameter indicates the tab for which 
		// the context menu is being displayed
		//
		if (true) //e.Tab.Key == "Custom")
		{
			if (this.customMenuItem == null)
			{
				// items added to the context menu should be
				// of type IGMenuItem so they can be owner drawn
				// using the appropriate style being used by 
				// the context menu
				this.customMenuItem = new Infragistics.Win.IGControls.IGMenuItem("Perform Custom Action");
				this.customMenuItem.Click += new EventHandler(this.OnCustomMenuItem);

				// the Image property of the IGMenuItem can
				// be used to specify your own menu item. the
				// image may be from a file or an integer
				// indicating the index of the image in the
				// tabbed mdi manager's ImageList
				//this.customMenuItem.Image = Image.FromFile(@"C:\menuItemImage.bmp");
				this.customMenuItem.Image = 0;
			}

			// the 'ContextMenu' parameter can be used to manipulate
			// the default menu items or add your own
			e.ContextMenu.MenuItems.Add(this.customMenuItem);
		}
	}
	else if (e.ContextMenuType == MdiTabContextMenu.Reposition)
	{
		// A ContextMenuType of Reposition is used when the user
		// drags a tab into an area within the mdi client but
		// not on a tab group control.
		//

		// Items in the specified 'ContextMenu' parameter may be 
		// manipulated.
		//
		foreach(MenuItem item in e.ContextMenu.MenuItems)
		{
			// the GetMenuType method can be used to determine
			// the action associated with a particular menu
			// item
			switch(e.GetMenuType(item))
			{
				case MdiTabMenuItems.Cancel:
				case MdiTabMenuItems.CancelSeparator:
					// we'll hide the cancel and cancel separator.
					// Note: if all the menu items are hidden
					// no context menu will be displayed
					//
					item.Visible = false;
					break;
			}
		}
	}
}
参照