Use with new application

1.    How to create a new MDI container.

a.    Launch Visual Studio.

b.    File->New->Project…, it will show the following dialog. Select “Windows Forms Application” as template and enter “MyProject” as project name.

          

 c.    Click “OK” button. You should see the following shown on your screen.

    

d.    Change Text to MyMDIForm, WindowState to Maximized, and IsMdiContainer to True.

e.    Rename the class name from Form1 to MyMDIForm.

f.     Project-> Add Reference…and it will show the following dialog. Select “Browse” tab. Choose both LinsUI.dll and UtilLib.dll under  \\LinsSoft\LinsUI\bin\Debug. Click “OK” button.

           

g.    Open MyMDIForm.cs file, add the following line

using LinsUI;

and change its base class from Form to LinsUI.FlexMDIForm, like the following,

public partial class MyMDIForm : LinsUI.FlexMDIForm

{

public MyMDIForm()

{

InitializeComponent();

}

} 

 h.    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.GetEntryAssembly();

// 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.GetDirectoryName(csAssemName);

int nIndex = csDirectory.LastIndexOf("Samples");

string csSampleDirectory = csDirectory.Substring(0, nIndex) + "Samples\\";

// Set the default path for saving the layout settings file,

FlexUISettings.AppSettingPath = Path.Combine(csDirectory, csProjectName);

            // Set the default path for get the Help file

            FlexUISettings.DefaultHelpFilePath = Path.Combine(csSampleDirectory, "Helps");

// Set the default path for icons

            FlexManager.DefaultIconsPath = Path.Combine(csSampleDirectory, "Icons");

Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(false);

Application.Run(new MDIForm());

}

2.    How to create a new child form.

a.    Project->Add Windows Form…, it should bring up the following dialog.

           

            Choose “Windows Forms” as Category and “Inherited Form” as Template. Use “MyChildForm” as the class name. Click “Add” button.

b.    It should show the “Inheritance Picker” dialog. Click “Browse…” button.

           

c.    It will show the following dialog. Go to \\LinsSoft\LinsUI\bin\Debug, and select LinsUI.dll. Click “Open” button.

           

d.    It will show the following dialog. Select “FlexForm”. Click “OK” button.

           

e.    In the “Properties” panel, set FlexDock to RIGHT.

            

f.    Open MyChildForm.cs file, add the following line

using LinsUI;

And assign a unique ID to it, like following

public partial class MyChidlForm : LinsUI.FlexForm

{

public MyChidlForm()

{

InitializeComponent();

this.ID = FlexConstants.m_nUserDefinedControlStartID + 1;

}

}

g.    You can create the form as following,

public MDIForm ()

{

SuspendLayout();

InitializeComponent(); 

// Create a child form.

MyChildForm myChildForm = new MyChildForm();

// Show the form.

myChildForm.ShowForm(); 

ResumeLayout( false );

PerformLayout();

}

3.    How to create a panel.

a.    Project->Add User Control…, it should bring up the following dialog.

           

Choose “Windows Forms” as Category and “Inherited User Control” as Template. Use “MyPanel” as the class name. Click “Add” button.

b.    It should show the “Inheritance Picker” dialog. Click “Browse…” button.

           

c.    It will show the following dialog. Go to \\LinsSoft\LinsUI\bin\Debug, and select LinsUI.dll. Click “Open” button.

           

d.    It will show the following dialog. Select “FlexPanel”. Click “OK” button.

           

e.    In the “Properties” panel, set Text to “Demo Panel” and FlexDock to RIGHT.

             

f.    Open MyPanel.cs file, add the following line

using LinsUI;

And assign a unique ID to it, like following

public partial class MyPanel : LinsUI.FlexPanel

{

public MyPanel()

{

InitializeComponent();

this.ID = FlexConstants.m_nUserDefinedControlStartID + 2;

}

}

g.    You can create the panel as following,

public MDIForm ()

{

SuspendLayout();

InitializeComponent(); 

// Create a child form.

MyChildForm myChildForm = new MyChildForm();

// Show the form.

myChildForm.ShowForm();

// Create a panel.

MyPanel myPanel = new MyPanel();

// Show the form.

myPanel.ShowPanel();

ResumeLayout( false );

PerformLayout();

}

4.    How to create a toolbar.

a.    Project->Add User Control…, it should bring up the following dialog.

           

Choose “Windows Forms” as Category and “Inherited User Control” as Template. Use “MyToolbar” as the class name. Click “Add” button.

b.    It should show the “Inheritance Picker” dialog. Click “Browse…” button.

           

c.    It will show the following dialog. Go to \\LinsSoft\LinsUI\bin\Debug, and select LinsUI.dll. Click “Open” button.

           

d.    It will show the following dialog. Select “FlexToolStrip”. Click “OK” button.

           

e.    Drag an ImageList from “ToolBox” into the toolstrip, and select some images/icons into the ImageList object.

             

f.    In the “Properties” panel, set Text to “Demo Toolbar”, ImageList to “imageList1.

           

g.    Add a button and a combo box into the toolbar as the following,

             

h.    Open MyToolbar.cs file, add the following line

using LinsUI;

And assign a unique ID to it, like following

public partial class MyToolbar : LinsUI.FlexToolStrip

{

public MyToolbar()

{

InitializeComponent();

this.ID = FlexConstants.m_nUserDefinedControlStartID + 3;

}

}

i.    Open MyToolbar.Designer.cs file, add the following line

using LinsUI;

Replace the following code,

// The old code

this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image")));

// The new code

this.toolStripButton1.ImageIndex = 0;

Also add the following line

this.toolStripComboBox1.ImageIndex = 1;

j.    You can create the toolbar as following,

public MDIForm ()

{

SuspendLayout();

InitializeComponent();

// Create a child form.

MyChildForm myChildForm = new MyChildForm();

// Show the form.

myChildForm.ShowForm();

// Create a panel.

MyPanel myPanel = new MyPanel();

// Show the panel.

myPanel.ShowPanel();

// Create a toolbar.

MyToolbar myToolbar = new MyToolbar();

// Show the toolbar.

myToolbar.ShowToolStrip(); 

// If you want to add the toolbar into a panel, you can do it this way

// myPanel.InsertToolStrip( myToolbar, 0, 0 );

ResumeLayout( false );

PerformLayout();

}

5.    How to create a menubar.

a.    Project->Add User Control…, it should bring up the following dialog.

           

Choose “Windows Forms” as Category and “Inherited User Control” as Template. Use “MyMenubar” as the class name. Click “Add” button.

b.    It should show the “Inheritance Picker” dialog. Click “Browse…” button.

           

c.    It will show the following dialog. Go to \\LinsSoft\LinsUI\bin\Debug, and select LinsUI.dll. Click “Open” button.

           

      d.    It will show the following dialog. Select “LinsMenuStrip”. Click “OK” button.

           

e.    Add some menu items into the menubar as the following,

          

f.    Open MyMenubar.cs file, add the following line

using LinsUI;

And assign a unique ID to it, like following

public partial class MyMenubar : LinsUI.LinsMenuStrip

{

public MyMenubar ()

{

InitializeComponent();

this.ID = FlexConstants.m_nUserDefinedControlStartID + 4;

}

}

g.    You can create the toolbar as following,

public MDIForm ()

{

SuspendLayout();

InitializeComponent();

// Create a child form.

MyChildForm myChildForm = new MyChildForm();

// Show the form.

myChildForm.ShowForm();

// Create a panel.

MyPanel myPanel = new MyPanel();

// Show the panel.

myPanel.ShowPanel(); 

// Create a toolbar.

MyToolbar c = new MyToolbar();

// Show the toolbar.

MyToolbar.ShowToolStrip(); 

// If you want to add the toolbar into a panel, you can do it this way

// myPanel.InsertToolStrip( myToolbar, 0, 0 ); 

// Create a menubar.

MyMenubar myMenubar = new MyMenubar();

// Show the menubar.

myMenubar.ShowMenuStrip();

// Set myMenubar as the main menu of the main frame.

SetMenuStrip( myMenubar );

// If you want to set the myMenubar as panel’s menubar, you can do it this way

// myPanel.SetMenuStrip( myMenubar );

ResumeLayout( false );

PerformLayout();

}