473,322 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,322 developers and data experts.

How to embed LinsUI Layout Manager 2.1 into an existing project

1. Locate the Form which is a container for multiple-document interface (MDI) child forms. Change its base class from Form to LinsUI.FlexMDIForm. For example, if MyMDIForm class is your MDI container,
// The old code
public partial class MyMDIForm : Form
{
}

// The new code
using LinsUI;
public partial class MyMDIForm : LinsUI.FlexMDIForm
{
}

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.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(fals e);
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_nUserDefinedControlStartID and FlexConstants.m_nUserDefinedControlEndID. For example,
// The old code
public partial class MyChildForm : Form
{
public MyChildForm()
{
InitializeComponent();
}
}

// The new code
using LinsUI;
public partial class MyChildForm : LinsUI.FlexForm
{
public MyChildForm ()
{
InitializeComponent();

// Assign a unique ID which should be between FlexConstants.m_nUserDefinedControlStartID and
// FlexConstants.m_nUserDefinedControlEndID
this.ID = FlexConstants.m_nUserDefinedControlStartID + 1;
}
}

Inside InitializeComponent(), assign the dock style.
using LinsUI;
private void InitializeComponent()
{
//
// your existing code
//

// Assign the dock style.
this.FlexDock = LinsUI.FLEX_DOCKING_ALIGN.LEFT;
}

You can create the derived form any where as following,
public partial class MyMDIForm : LinsUI.FlexMDIForm
{
public MyMDIForm ()
{
SuspendLayout();
InitializeComponent();

// Create a child form.
MyChildForm myChildForm = new MyChildForm();
// Show the form.
myChildForm.ShowForm();

ResumeLayout( false );
PerformLayout();
}
}

Note: You do not need to assign a parent to the derived form. So remove all the code like this.Controls.Add( myChildForm ).

4. Change the base class of all panels from Panel to LinsUI.FlexPanel, and assign the panel a unique ID which should be between FlexConstants.m_nUserDefinedControlStartID and FlexConstants.m_nUserDefinedControlEndID. For example,
// The old code
public partial class MyPanel : Panel
{
public MyPanel()
{InitializeComponent();
}
}

// The new code
using LinsUI;
public partial class MyPanel : LinsUI.FlexPanel
{
public MyPanel ()
{
InitializeComponent();
// Assign a unique ID which should be between FlexConstants.m_nUserDefinedControlStartID and
// FlexConstants.m_nUserDefinedControlEndID
this.ID = FlexConstants.m_nUserDefinedControlStartID + 2;
}
}

Inside InitializeComponent(), assign the dock style.
using LinsUI;
private void InitializeComponent()
{
//
// your existing code
//

//Assign the dock style.
this.FlexDock = LinsUI.FLEX_DOCKING_ALIGN.RIGHT;
}

You can create the derived panel any where as following,
public partial class MyMDIForm : LinsUI.FlexMDIForm
{
public MyMDIForm ()
{
SuspendLayout();
InitializeComponent();

// Create a panel.
MyPanel myPanel = new MyPanel();
// Show the panel.
myPanel.ShowPanel();

ResumeLayout( false );
PerformLayout();
}
}

Note: You do not need to assign a parent to the derived panel. So remove all the code like this.Controls.Add( myPanel ).

5. Change the base class of all toolbars from ToolStrip to LinsUI.FlexToolStrip, and assign the toolbar a unique ID which should be between FlexConstants.m_nUserDefinedControlStartID and FlexConstants.m_nUserDefinedControlEndID. For example,
// The old code
public partial class MyToolStrip : ToolStrip
{
public MyToolStrip()
{InitializeComponent();
}
}

// The new code
using LinsUI;
public partial class MyToolStrip : LinsUI.FlexToolStrip
{
public MyToolStrip ()
{
InitializeComponent();
// Assign a unique ID which should be between FlexConstants.m_nUserDefinedControlStartID and
// FlexConstants.m_nUserDefinedControlEndID
this.ID = FlexConstants.m_nUserDefinedControlStartID + 3;
}
}

Inside InitializeComponent(), assign the dock style.
using LinsUI;
private void InitializeComponent()
{
//
// your existing code
//

// Assign the dock style.
this.FlexDock = LinsUI.FLEX_DOCKING_ALIGN.RIGHT;
}

You can create the derived toolbar any where as following,
public partial class MyMDIForm : LinsUI.FlexMDIForm
{
public MyMDIForm ()
{
SuspendLayout();
InitializeComponent();

// 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.Add( myToolbar ).

6. Change the base class of all menu bars from MenuStrip to LinsUI.LinsMenuStrip, and assign the menu bar a unique ID which should be between FlexConstants.m_nUserDefinedControlStartID and FlexConstants.m_nUserDefinedControlEndID. For example,
// The old code
public partial class MyMenuStrip : ToolStrip
{
public MyToolStrip()
{InitializeComponent();
}
}

// The new code
using LinsUI;
public partial class MyMenuStrip : LinsUI.LinsMenuStrip
{
public MyMenuStrip()
{
InitializeComponent();
//Assign a unique ID which should be between FlexConstants.m_nUserDefinedControlStartID and
//FlexConstants.m_nUserDefinedControlEndID
this.ID = FlexConstants.m_nUserDefinedControlStartID + 3;
}
}

Example 1:
You can assign the derived menu bar as the main menu as following,
public partial class MyMDIForm : LinsUI.FlexMDIForm
{
public MyMDIForm ()
{
SuspendLayout();
InitializeComponent();

// 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.FlexPanel
{
public MyPanel()
{
SuspendLayout();
InitializeComponent();
// Assign a unique ID which should be between FlexConstants.m_nUserDefinedControlStartID and
// FlexConstants.m_nUserDefinedControlEndID
this.ID = FlexConstants.m_nUserDefinedControlStartID + 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.Add( myMenubar ).
After you do all of above, you are ready to use the LinsUI Layout Manager.
Dec 23 '10 #1
0 3812

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Greg Chu | last post by:
Hi, on the start page of the IDE, you see "open an existing project". Currently I only have 4 existing project listed. Is there a place that I can change to list more existing projects? Thanks!...
0
by: Andrew Fedoniouk | last post by:
Announce: Lightweight HTML forms layout manager and browser component. http://HtmLayout.com Latest version of HtmLayoutSDK contains sources of wrapper for .NET (C#) Andrew Fedoniouk....
4
by: Kerry Sanders | last post by:
I was playing around with a new Windows form yesterday. I wanted to drop two panels on the form. The first would be set Dock=Top. The second would be set Dock=Fill. So, I dropped the first...
5
by: Kevin Buchan | last post by:
I came in today and tried to edit a project that I was working with, locally, at the tail end of last week. This web project was created, hosted, and only edited locally. I truly cannot...
2
by: ed d | last post by:
Hi, When I try to create a new web project, or "add existing project from web" or "open from source control" i'm prompted for a URL and type in a virtual directory. -- with "add project...
2
by: Joe Wedel | last post by:
I have a Solution with 4 Projects, one of which is not loading. I get the error message: Microsoft Development Environment Unable to read the project file 'CouncilAgenda.vbproj'. The project...
0
by: newjazzharmony | last post by:
I'm working in Visual Studio 2003 and I'm trying to add a web project to a solution. When I right-click on the solution and select "Add Existing Project you want to add the project from:" that is...
0
by: Narasimham | last post by:
Hi, I was able to successfully create a new project using the devenv command line arguments. I did devenv /command np and then specified the name of the project and its location in the
2
by: trullock | last post by:
Hi, Ive installed the ASP.NET AJAX extensions and ive set up a simple example, however its not doing anything asynchronously, its always posting back... Could this be something to do with the...
3
by: nehamaru | last post by:
which layout manager honours the preferd component size ? i am confuing it is border or flow layout ?
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.