-
Using the UIPanelManager as a TabbedMdi control [Janus UI and Ribbon Controls v3.5 for .NET]
To give your MDI Container Form a TabbedMdi layout you just need to place a UIPanelManager component on the Form and set its TabbedMdi property as true.
Setting properties for individual tab pages
You can use the MdiTabInitialize event to assign the text, tooltip text or the format style for the tab items.
In C#:
private void uiPanelManager1_MdiTabInitialize(object sender, Janus.Windows.UI.Dock.MdiTabInitializeEventArgs e)
{
e.Tab.ToolTipText = "ToolTipText for the TabPage";
e.Tab.StateStyles.FormatStyle.BackColor = Color.Red;
//Use the CustomProperties class to add custom information for the tab page.
e.Tab.CustomProperties.Add("FormType", e.Tab.Form.GetType().Name);
}
In VB:
Private Sub UiPanelManager1_MdiTabInitialize(ByVal sender As Object, ByVal e As Janus.Windows.UI.Dock.MdiTabInitializeEventArgs) Handles UiPanelManager1.MdiTabInitialize
e.Tab.ToolTipText = "ToolTipText for the TabPage"
e.Tab.StateStyles.FormatStyle.BackColor = Color.Red
'Use the CustomProperties class to add custom information for the tab page
e.Tab.CustomProperties.Add("FormType", e.Tab.Form.GetType().Name)
End Sub
Using a layout file to preserve the tabbed Mdi layout
The following code shows how to save the tabbed Mdi layout into a file
In VB:
Private Sub SaveLayout()
Dim LayoutDir As String = "C:\UIBarsLayout.xml"
Dim LayoutStream As FileStream
LayoutStream = New FileStream(LayoutDir, FileMode.Create)
UiPanelManager1.SaveLayoutFile(LayoutStream, Janus.Windows.UI.Dock.PersistMode.TabbedMdiLayout)
LayoutStream.Close()
End Sub
In C#:
private void SaveLayout()
{
string layoutDir = @"C:\UIBarsLayout.xml";
FileStream layoutStream;
layoutStream = new FileStream(layoutDir, FileMode.Create);
uiPanelManager1.SaveLayoutFile(layoutStream, Janus.Windows.UI.Dock.PersistMode.TabbedMdiLayout);
layoutStream.Close();
}
The following code shows how to load the tabbed Mdi layout from a file
In VB:
Private Sub LoadLayout()
Dim LayoutDir As String = "C:\UIBarsLayout.xml"
Dim LayoutStream As FileStream
LayoutStream = New FileStream(LayoutDir, FileMode.Open)
UiPanelManager1.LoadLayoutFile(LayoutStream)
LayoutStream.Close()
End Sub
In C#:
private void LoadLayout()
{
string layoutDir = @"C:\UIBarsLayout.xml";
FileStream layoutStream;
layoutStream = new FileStream(layoutDir, FileMode.Open);
uiPanelManager1.LoadLayoutFile(layoutStream);
layoutStream.Close();
}
Use the RestoreMdiChildForm event to load the forms that were open when the layout was saved.
In C#:
private void uiPanelManager1_RestoreMdiChildForm(object sender, Janus.Windows.UI.Dock.RestoreMdiChildFormEventArgs e)
{
//Get the type of the form that was stored in the MDITabInitialize event
string formType = (string)e.Tab.CustomProperties["FormType"].Value;
if (formType == "Form2")
{
Form2 frm = new Form2();
frm.MdiParent = this;
//Set the new Form as the Form for the tab.
e.Form = frm;
frm.Show();
}
}
In VB:
Private Sub UiPanelManager1_RestoreMdiChildForm(ByVal sender As Object, ByVal e As Janus.Windows.UI.Dock.RestoreMdiChildFormEventArgs) Handles UiPanelManager1.RestoreMdiChildForm
'Get the type of the form that was stored in the MDITabInitializeEvent
Dim formType As String = e.Tab.CustomProperties("FormType").Value
If formType = "Form2" Then
Dim frm As Form2 = New Form2()
frm.MdiParent = Me
'Set the new Form as the Form for the tab.
e.Form = frm
frm.Show()
End If
End Sub
Source Of Information : Janus v3.5 Help Files for VS 2008
Subscribe to:
Post Comments (Atom)
0 comments: