'Declaration Public Event RestoreTab As RestoreTabEventHandler
public event RestoreTabEventHandler RestoreTab
The event handler receives an argument of type RestoreTabEventArgs containing data related to this event. The following RestoreTabEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Form | Returns or sets the Form associated with the tab. |
Tab (Inherited from Infragistics.Win.UltraWinTabbedMdi.MdiTabEventArgs) | Returns the associated MdiTab |
WasVisible | ReadOnly. Indicates if the associated form was visible when the tab was serialized. |
The RestoreTab event is invoked when the LoadFromBinary(Stream) or LoadFromXml(Stream) method is called and there are serialized MdiTab objects. The event is invoked so that the deserialized tab can be associated with an mdi child form. This is done by setting the RestoreTabEventArgs.Form property. If this is not specified, the MdiTab will be discarded. You can use the PersistedInfo property of the MdiTab to store information about the form it should be associated with during deserialization (e.g. store a file name).
Note: Any forms created during this event will not have an MdiTab associated with it so that a form can be created in this event and used to set the RestoreTabEventArgs.Form property.
Imports Infragistics.Win Imports Infragistics.Win.UltraWinTabs Imports Infragistics.Win.UltraWinTabbedMdi Private Sub ultraTabbedMdiManager1_RestoreTab(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTabbedMdi.RestoreTabEventArgs) Handles ultraTabbedMdiManager1.RestoreTab ' The 'RestoreTab' event is invoked during a call to ' LoadFromBinary or LoadFromXml when deserializing the ' serialized MdiTab objects. The event is invoked once ' for each serialized tab so that it may be associated ' with an mdi child. If the Form is not initialized the ' tab will be discarded. ' ' The 'PersistedInfo' can be used to store any serializable ' value. It is opaque to the tab and can be used to store ' information to help recreate the form that the tab should ' be associated with. ' Dim fileName As String = CType(e.Tab.PersistedInfo, String) ' By exiting without setting the 'Form' parameter, ' we're discarding the tab. If fileName = Nothing Or Not System.IO.File.Exists(fileName) Then Return End If ' Create the form that we will associate with the Tab. Normally ' whenever an mdi child form is created, an MdiTab is automatically ' created for the form but during the RestoreTab event, this will ' not happen so that new forms may be created to associate with ' a deserialized tab. ' Dim edit As EditForm = New EditForm() edit.FileName = fileName ' set the MdiParent property of the new form so it ' will be an mdi child form. Since the event could ' be caught somewhere other than the form class, we ' can access the MdiParent via the associated ' UltraTabbedMdiManager's MdiParent. edit.MdiParent = e.Tab.Manager.MdiParent ' The 'WasVisible' parameter indicates whether the tab ' was part of the HiddenTabs collection when the serialization ' took place. If the visible state is different, then the ' tab will be moved to/from the HiddenTabs collection to/from ' a tab group as needed. ' edit.Visible = e.WasVisible ' Set the 'Form' parameter so that the MdiTab will be ' associated with the form. e.Form = edit End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinTabs; using Infragistics.Win.UltraWinTabbedMdi; private void ultraTabbedMdiManager1_RestoreTab(object sender, Infragistics.Win.UltraWinTabbedMdi.RestoreTabEventArgs e) { // The 'RestoreTab' event is invoked during a call to // LoadFromBinary or LoadFromXml when deserializing the // serialized MdiTab objects. The event is invoked once // for each serialized tab so that it may be associated // with an mdi child. If the Form is not initialized the // tab will be discarded. // // The 'PersistedInfo' can be used to store any serializable // value. It is opaque to the tab and can be used to store // information to help recreate the form that the tab should // be associated with. // string fileName = e.Tab.PersistedInfo as string; // By exiting without setting the 'Form' parameter, // we're discarding the tab. if (fileName == null || !System.IO.File.Exists(fileName)) return; // Create the form that we will associate with the Tab. Normally // whenever an mdi child form is created, an MdiTab is automatically // created for the form but during the RestoreTab event, this will // not happen so that new forms may be created to associate with // a deserialized tab. // EditForm edit = new EditForm(); edit.FileName = fileName; // set the MdiParent property of the new form so it // will be an mdi child form. Since the event could // be caught somewhere other than the form class, we // can access the MdiParent via the associated // UltraTabbedMdiManager's MdiParent. edit.MdiParent = e.Tab.Manager.MdiParent; // The 'WasVisible' parameter indicates whether the tab // was part of the HiddenTabs collection when the serialization // took place. If the visible state is different, then the // tab will be moved to/from the HiddenTabs collection to/from // a tab group as needed. // edit.Visible = e.WasVisible; // Set the 'Form' parameter so that the MdiTab will be // associated with the form. e.Form = edit; }
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