Version

InitializeTab Event

Event that occurs when a new MdiTab is created for an mdichild form.
Syntax
'Declaration
 
Public Event InitializeTab As MdiTabEventHandler
public event MdiTabEventHandler InitializeTab
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

The InitializeTab event is invoked when a new MdiTab is created for an mdi child form before it has been associated with an MdiTabGroup. This event provides an opportunity to initialize the tab before it is displayed.

Note: Invoking one of the move methods (e.g. MoveToNewGroup(MdiTab)) on the MdiTabEventArgs.Tab will result in an exception.

Example
The following example demonstrates how to use the InitializeTab event to initialize settings for a new MdiTab object.

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_InitializeTab(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTabbedMdi.MdiTabEventArgs) Handles ultraTabbedMdiManager1.InitializeTab
    ' The 'InitializeTab' event can be used to initialize the
    ' settings for a new tab. The event is invoked when a new 
    ' MdiTab is created for a form. The 'Tab' parameter provides 
    ' the tab being initialized.
    '

    ' The text displayed by the tab is, by default, based 
    ' on the Text property of the form. The 'Text' property 
    ' of the tab may be set to override that value.
    e.Tab.Text = "New MdiChild " & e.Tab.Form.MdiParent.MdiChildren.Length

    ' This event is probably a good point to initialize the 'Key' 
    ' of the tab so that the tab may be located by this string later.
    '
    'e.Tab.Key = "abc"

    ' The 'Form' property is initialized by the time this event 
    ' is invoked and returns the mdi child form that the tab is 
    ' associated with.
    '
    If TypeOf e.Tab.Form Is MdiChildDialog Then
        e.Tab.ToolTip = "Mdi Child Dialog"
    End If

    ' The 'Settings' property of the tab will return an 
    ' MdiTabSettings instance that can be used to initialize
    ' the settings specifically for this tab.
    '

    ' The 'DisplayFormIcon' can be used to set the default 
    ' image of the tab to the icon of the associated form.
    '
    e.Tab.Settings.DisplayFormIcon = DefaultableBoolean.True
End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinTabs;
using Infragistics.Win.UltraWinTabbedMdi;

private void ultraTabbedMdiManager1_InitializeTab(object sender, Infragistics.Win.UltraWinTabbedMdi.MdiTabEventArgs e)
{
	// The 'InitializeTab' event can be used to initialize the
	// settings for a new tab. The event is invoked when a new 
	// MdiTab is created for a form. The 'Tab' parameter provides 
	// the tab being initialized.
	//

	// The text displayed by the tab is, by default, based 
	// on the Text property of the form. The 'Text' property 
	// of the tab may be set to override that value.
	e.Tab.Text = "New MdiChild " + e.Tab.Form.MdiParent.MdiChildren.Length;

	// This event is probably a good point to initialize the 'Key' 
	// of the tab so that the tab may be located by this string later.
	//
	//e.Tab.Key = "abc";

	// The 'Form' property is initialized by the time this event 
	// is invoked and returns the mdi child form that the tab is 
	// associated with.
	//
	if ( e.Tab.Form is MdiChildDialog )
		e.Tab.ToolTip = "Mdi Child Dialog";

	// The 'Settings' property of the tab will return an 
	// MdiTabSettings instance that can be used to initialize
	// the settings specifically for this tab.
	//
	
	// The 'DisplayFormIcon' can be used to set the default 
	// image of the tab to the icon of the associated form.
	//
	e.Tab.Settings.DisplayFormIcon = DefaultableBoolean.True;
}
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