LoadFromBinary メソッドは、UltraTabbedMdiManager の設定およびレイアウトを永続化するために SaveAsBinary(Stream) メソッドと組み合わせて使用します。MdiTab オブジェクトと TabGroups を含みすべてのプロパティ設定 (ImageList を除く) は、逆シリアル化されます。情報が逆シリアル化された後、RestoreTab イベントがシリアル化された MdiTab ごとに呼び出されます。これにより、適切な Form をタブに関連付けることができます。このイベントでタブが Form に関連付けられない場合、そのタブは破棄されます。
Imports Infragistics.Win Imports Infragistics.Win.UltraWinTabs Imports Infragistics.Win.UltraWinTabbedMdi Private Sub SaveBinaryLayout() Dim path As String = System.IO.Path.GetDirectoryName(Application.ExecutablePath) Dim fileName As String = path + "\\TabbedMdiLayout.dat" Dim fs As System.IO.FileStream = New System.IO.FileStream(fileName, System.IO.FileMode.OpenOrCreate) Try fs.Seek(0, System.IO.SeekOrigin.Begin) Me.ultraTabbedMdiManager1.SaveAsBinary(fs) Finally fs.Close() End Try End Sub Private Sub LoadBinaryLayout() Dim path As String = System.IO.Path.GetDirectoryName(Application.ExecutablePath) Dim fileName As String = path + "\\TabbedMdiLayout.dat" Dim fs As System.IO.FileStream = Nothing If Not System.IO.File.Exists(fileName) Then Return End If Try fs = New System.IO.FileStream(fileName, System.IO.FileMode.Open) fs.Seek(0, System.IO.SeekOrigin.Begin) Me.ultraTabbedMdiManager1.LoadFromBinary(fs) Finally If Not fs Is Nothing Then fs.Close() End If End Try End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinTabs; using Infragistics.Win.UltraWinTabbedMdi; private void SaveBinaryLayout() { string path = System.IO.Path.GetDirectoryName(Application.ExecutablePath); string fileName = path + "\\TabbedMdiLayout.dat"; System.IO.FileStream fs = new System.IO.FileStream(fileName, System.IO.FileMode.OpenOrCreate); try { fs.Seek(0, System.IO.SeekOrigin.Begin); this.ultraTabbedMdiManager1.SaveAsBinary(fs); } finally { fs.Close(); } } private void LoadBinaryLayout() { string path = System.IO.Path.GetDirectoryName(Application.ExecutablePath); string fileName = path + "\\TabbedMdiLayout.dat"; System.IO.FileStream fs = null; if (!System.IO.File.Exists(fileName)) return; try { fs = new System.IO.FileStream(fileName, System.IO.FileMode.Open); fs.Seek(0, System.IO.SeekOrigin.Begin); this.ultraTabbedMdiManager1.LoadFromBinary(fs); } finally { if (fs != null) fs.Close(); } }