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; }