Version

TabDisplaying Event

Event that occurs when the visibility of the Form of an MdiTab is changed to true and the MdiTab is being displayed in an MdiTabGroup.
Syntax
'Declaration
 
Public Event TabDisplaying As MdiTabEventHandler
public event MdiTabEventHandler TabDisplaying
Event Data

The event handler receives an argument of type MdiTabEventArgs containing data related to this event. The following MdiTabEventArgs properties provide information specific to this event.

PropertyDescription
Tab Returns the associated MdiTab
Remarks

MdiTab objects associated with non-visible forms are stored in the HiddenTabs collection and are not associated with a particular MdiTabGroup. When the associated Form is made visible, the tab is removed from the HiddenTabs and added to a MdiTabGroup. The TabDisplaying event is invoked when the tab has been added to a MdiTabGroup but before the display has been updated.

Example
The following sample demonstrates how to use the information passed to the TabDisplaying 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_TabDisplaying(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTabbedMdi.MdiTabEventArgs) Handles ultraTabbedMdiManager1.TabDisplaying
    ' The 'TabDisplaying' event is invoked when a tab in the 
    ' HiddenTabs collection is about to be moved to an 
    ' MdiTabGroup that will display the tab but before the
    ' display has been updated.
    '

    ' The 'Tab' parameter returns the tab being displayed.
    '

    ' when we are going to show our edit forms, have them all 
    ' in the one tab group
    If TypeOf e.Tab.Form Is EditForm Then
        ' if the "Edit" group exists, then move the tab to that group
        If e.Tab.Manager.TabGroups.Exists("Edit") Then
            e.Tab.MoveToGroup(e.Tab.Manager.TabGroups("Edit"))
        Else
            ' put it in a new tab group

            ' the method will return the new tab group
            Dim tabGroup As MdiTabGroup = e.Tab.MoveToNewGroup(MdiTabGroupPosition.Last)

            ' initialize the key of the tab group
            tabGroup.Key = "Edit"

            ' prevent tabs being dragged into this group
            ' from other groups
            tabGroup.Settings.AllowDrop = DefaultableBoolean.False
        End If
    End If
End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinTabs;
using Infragistics.Win.UltraWinTabbedMdi;

private void ultraTabbedMdiManager1_TabDisplaying(object sender, Infragistics.Win.UltraWinTabbedMdi.MdiTabEventArgs e)
{
	// The 'TabDisplaying' event is invoked when a tab in the 
	// HiddenTabs collection is about to be moved to an 
	// MdiTabGroup that will display the tab but before the
	// display has been updated.
	//

	// The 'Tab' parameter returns the tab being displayed.
	//

	// when we are going to show our edit forms, have them all 
	// in the one tab group
	if (e.Tab.Form is EditForm)
	{
		// if the "Edit" group exists, then move the tab to that group
		if (e.Tab.Manager.TabGroups.Exists("Edit"))
			e.Tab.MoveToGroup(e.Tab.Manager.TabGroups["Edit"]);
		else
		{
			// put it in a new tab group

			// the method will return the new tab group
			MdiTabGroup tabGroup = e.Tab.MoveToNewGroup(MdiTabGroupPosition.Last);

			// initialize the key of the tab group
			tabGroup.Key = "Edit";

			// prevent tabs being dragged into this group
			// from other groups
			tabGroup.Settings.AllowDrop = DefaultableBoolean.False;
		}
	}
}
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