Version

CancelableMdiTabEventHandler Delegate

Delegate for handling a cancelable event involving an MdiTab
Syntax
'Declaration
 
Public Delegate Sub CancelableMdiTabEventHandler( _
   ByVal sender As Object, _
   ByVal e As CancelableMdiTabEventArgs _
) 
public delegate void CancelableMdiTabEventHandler( 
   object sender,
   CancelableMdiTabEventArgs e
)

Parameters

sender
e
Example
The following sample demonstrates how to use the information passed to the TabMoving event.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinTabs
Imports Infragistics.Win.UltraWinTabbedMdi

Private Sub ultraTabbedMdiManager1_TabMoving(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTabbedMdi.MdiTabMovingEventArgs) Handles ultraTabbedMdiManager1.TabMoving
    ' The 'TabMoving' event is invoked when a tab is about
    ' to be repositioned. It may be repositioned within a 
    ' group or moved to another group.

    ' The 'Cancel' parameter may be set to true to 
    ' prevent the move operation from occuring.
    '
    'e.Cancel = True

    Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder()
    sb.AppendFormat("TabMoving: Tab ['{0}'] ", e.Tab)

    ' The 'Tab' parameter returns the MdiTab object that is
    ' about to be repositioned. The 'TabGroup' parameter returns 
    ' the TabGroup that will contain the tab. The 'TabIndex'
    ' parameter returns the index at which the tab will be 
    ' positioned.

    If e.Tab.TabGroup Is e.TabGroup Then
        ' it is being repositioned within its containing group
        Dim index As Integer = e.Tab.TabGroup.Tabs.IndexOf(e.Tab)
        sb.AppendFormat("is being moved within its group from index {0} to {1}.", index, e.TabIndex)
    ElseIf e.TabGroup.Tabs.Count = 0 Then
        ' it is being repositioned to a new group
        sb.Append("is being moved to a new MdiTabGroup. ")
        sb.AppendFormat("The new group is located at index: {0}.", e.TabGroup.Manager.TabGroups.IndexOf(e.TabGroup))
    Else
        ' it is being repositioned in a different group
        sb.Append("is being moved to an existing tab group. ")
        sb.AppendFormat("The tab will be positioned at index {0}", e.TabIndex)
    End If

    System.Diagnostics.Debug.WriteLine(sb.ToString())
End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinTabs;
using Infragistics.Win.UltraWinTabbedMdi;

private void ultraTabbedMdiManager1_TabMoving(object sender, Infragistics.Win.UltraWinTabbedMdi.MdiTabMovingEventArgs e)
{
	// The 'TabMoving' event is invoked when a tab is about
	// to be repositioned. It may be repositioned within a 
	// group or moved to another group.
	
	// The 'Cancel' parameter may be set to true to 
	// prevent the move operation from occuring.
	//
	//e.Cancel = true;

	System.Text.StringBuilder sb = new System.Text.StringBuilder();
	sb.AppendFormat("TabMoving: Tab ['{0}'] ", e.Tab);

	// The 'Tab' parameter returns the MdiTab object that is
	// about to be repositioned. The 'TabGroup' parameter returns 
	// the TabGroup that will contain the tab. The 'TabIndex'
	// parameter returns the index at which the tab will be 
	// positioned.

	if (e.Tab.TabGroup == e.TabGroup)
	{
		// it is being repositioned within its containing group
		int index = e.Tab.TabGroup.Tabs.IndexOf(e.Tab);
		sb.AppendFormat("is being moved within its group from index {0} to {1}.", index, e.TabIndex);
	}
	else if (e.TabGroup.Tabs.Count == 0) 
	{
		// it is being repositioned to a new group
		sb.Append("is being moved to a new MdiTabGroup. ");
		sb.AppendFormat("The new group is located at index: {0}.", e.TabGroup.Manager.TabGroups.IndexOf(e.TabGroup));
	}
	else
	{
		// it is being repositioned in a different group
		sb.Append("is being moved to an existing tab group. ");
		sb.AppendFormat("The tab will be positioned at index {0}", e.TabIndex);
	}

	System.Diagnostics.Debug.WriteLine( sb.ToString() );
}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also