// The old code
public partial class MyMDIForm : Form
{
}
// The new code
using LinsUI;
public partial class MyMDIForm : LinsUI.FlexMDIF orm
{
}
2. Open Program.cs file, set the default path for the layout settings file, the default path for the help file, and the default path for the icons.
[STAThread]
static void Main()
{
// Get the entry assembly}
Assembly assem = Assembly.GetEnt ryAssembly();
// Get the application location
string csAssemName = assem.Location;
// Get the applicationb name
string csProjectName = assem.GetName() .Name;
// Get the path where the application is located
string csDirectory = Path.GetDirecto ryName(csAssemN ame);
int nIndex = csDirectory.Las tIndexOf("Sampl es");
string csSampleDirecto ry = csDirectory.Sub string(0, nIndex) + "Samples\\" ;
// Set the default path for saving the layout settings file,
FlexUISettings. AppSettingPath = Path.Combine(cs Directory, csProjectName);
// Set the default path for get the Help file
FlexUISettings. DefaultHelpFile Path = Path.Combine(cs SampleDirectory , "Helps"); ;
// Set the default path for icons
FlexManager.Def aultIconsPath = Path.Combine(cs SampleDirectory , "Icons");
Application.Ena bleVisualStyles ();
Application.Set CompatibleTextR enderingDefault (false);
Application.Run (new MDIForm());
3. Change the base class of all child forms from Form to LinsUI.FlexForm , and assign every form a unique ID which should be between FlexConstants.m _nUserDefinedCo ntrolStartID and FlexConstants.m _nUserDefinedCo ntrolEndID. For example,
// The old code
public partial class MyChildForm : Form
{
public MyChildForm()}
{
InitializeCompo nent();
}
// The new code
using LinsUI;
public partial class MyChildForm : LinsUI.FlexForm
{
public MyChildForm ()}
{
InitializeCompo nent();
// Assign a unique ID which should be between FlexConstants.m _nUserDefinedCo ntrolStartID and
// FlexConstants.m _nUserDefinedCo ntrolEndID
this.ID = FlexConstants.m _nUserDefinedCo ntrolStartID + 1;
}
Inside InitializeCompo nent(), assign the dock style.
using LinsUI;
private void InitializeCompo nent()
{
//}
// your existing code
//
// Assign the dock style.
this.FlexDock = LinsUI.FLEX_DOC KING_ALIGN.LEFT ;
You can create the derived form any where as following,
public partial class MyMDIForm : LinsUI.FlexMDIF orm
{
public MyMDIForm ()}
{SuspendLayout() ;}
InitializeCompo nent();
// Create a child form.
MyChildForm myChildForm = new MyChildForm();
// Show the form.
myChildForm.Sho wForm();
ResumeLayout( false );
PerformLayout() ;
Note: You do not need to assign a parent to the derived form. So remove all the code like this.Controls.A dd( myChildForm ).
4. Change the base class of all panels from Panel to LinsUI.FlexPane l, and assign the panel a unique ID which should be between FlexConstants.m _nUserDefinedCo ntrolStartID and FlexConstants.m _nUserDefinedCo ntrolEndID. For example,
// The old code
public partial class MyPanel : Panel
{
public MyPanel()}
{InitializeCompo nent();
}
// The new code
using LinsUI;
public partial class MyPanel : LinsUI.FlexPane l
{
public MyPanel ()}
{InitializeCompo nent();}
// Assign a unique ID which should be between FlexConstants.m _nUserDefinedCo ntrolStartID and
// FlexConstants.m _nUserDefinedCo ntrolEndID
this.ID = FlexConstants.m _nUserDefinedCo ntrolStartID + 2;
Inside InitializeCompo nent(), assign the dock style.
using LinsUI;
private void InitializeCompo nent()
{
//}
// your existing code
//
//Assign the dock style.
this.FlexDock = LinsUI.FLEX_DOC KING_ALIGN.RIGH T;
You can create the derived panel any where as following,
public partial class MyMDIForm : LinsUI.FlexMDIF orm
{
public MyMDIForm ()}
{SuspendLayout() ;}
InitializeCompo nent();
// Create a panel.
MyPanel myPanel = new MyPanel();
// Show the panel.
myPanel.ShowPan el();
ResumeLayout( false );
PerformLayout() ;
Note: You do not need to assign a parent to the derived panel. So remove all the code like this.Controls.A dd( myPanel ).
5. Change the base class of all toolbars from ToolStrip to LinsUI.FlexTool Strip, and assign the toolbar a unique ID which should be between FlexConstants.m _nUserDefinedCo ntrolStartID and FlexConstants.m _nUserDefinedCo ntrolEndID. For example,
// The old code
public partial class MyToolStrip : ToolStrip
{
public MyToolStrip()}
{InitializeCompo nent();
}
// The new code
using LinsUI;
public partial class MyToolStrip : LinsUI.FlexTool Strip
{
public MyToolStrip ()}
{InitializeCompo nent();}
// Assign a unique ID which should be between FlexConstants.m _nUserDefinedCo ntrolStartID and
// FlexConstants.m _nUserDefinedCo ntrolEndID
this.ID = FlexConstants.m _nUserDefinedCo ntrolStartID + 3;
Inside InitializeCompo nent(), assign the dock style.
using LinsUI;
private void InitializeCompo nent()
{
//}
// your existing code
//
// Assign the dock style.
this.FlexDock = LinsUI.FLEX_DOC KING_ALIGN.RIGH T;
You can create the derived toolbar any where as following,
public partial class MyMDIForm : LinsUI.FlexMDIF orm
{
public MyMDIForm ()}
{SuspendLayout() ;}
InitializeCompo nent();
// Create a toolbar.
MyToolStrip myToolbar = new MyToolStrip();
// Show the toolbar.
myToolbar. ShowToolStrip() ;
ResumeLayout( false );
PerformLayout() ;
Note: You do not need to assign a parent to the derived toolbar. So remove all the code like this.Controls.A dd( myToolbar ).
6. Change the base class of all menu bars from MenuStrip to LinsUI.LinsMenu Strip, and assign the menu bar a unique ID which should be between FlexConstants.m _nUserDefinedCo ntrolStartID and FlexConstants.m _nUserDefinedCo ntrolEndID. For example,
// The old code
public partial class MyMenuStrip : ToolStrip
{
public MyToolStrip()}
{InitializeCompo nent();
}
// The new code
using LinsUI;
public partial class MyMenuStrip : LinsUI.LinsMenu Strip
{
public MyMenuStrip()}
{InitializeCompo nent();}
//Assign a unique ID which should be between FlexConstants.m _nUserDefinedCo ntrolStartID and
//FlexConstants.m _nUserDefinedCo ntrolEndID
this.ID = FlexConstants.m _nUserDefinedCo ntrolStartID + 3;
Example 1:
You can assign the derived menu bar as the main menu as following,
public partial class MyMDIForm : LinsUI.FlexMDIF orm
{
public MyMDIForm ()}
{SuspendLayout() ;}
InitializeCompo nent();
// Create a menu bar.
MyMenuStrip myMenubar = new MyMenuStrip();
// Show the menu bar.
myMenubar. ShowMenuStrip() ;
// Set myMenubar as the main menu.
SetMenuStrip( myMenubar );
ResumeLayout( false );
PerformLayout() ;
Example 2:
Or you can assign the derived menu bar as a panel’s menu bar,
public partial class MyPanel : LinsUI.FlexPane l
{
public MyPanel()}
{SuspendLayout() ;}
InitializeCompo nent();
// Assign a unique ID which should be between FlexConstants.m _nUserDefinedCo ntrolStartID and
// FlexConstants.m _nUserDefinedCo ntrolEndID
this.ID = FlexConstants.m _nUserDefinedCo ntrolStartID + 1;
// Create a menu bar.
MyMenuStrip myMenubar = new MyMenuStrip();
// Show the menu bar.
myMenubar. ShowMenuStrip() ;
// Set myMenubar as the menu bar of this panel.
SetMenuStrip( myMenubar );
ResumeLayout( false );
PerformLayout() ;
Note: You do not need to assign a parent to the derived menu bar. So remove all the code like this.Controls.A dd( myMenubar ).
After you do all of above, you are ready to use the LinsUI Layout Manager.