Sunday, January 2, 2011

FlexPanel class of LinsUI Layout Manager 2.1

It is a customized dockable Panel object; it owns all features of winform class Panel’s.
The user can drag a FlexPanel object and dock it at any place during run time. Can also drag a FlexPanel object into a sheet and make it becomes one of the pages of the sheet. You can also hide a FlexPanel object by click at its “Pin” button. The visibility of a FlexPanel object can be turned on/off.
§      Members
1)  public long ID { get; set; }               
Remarks
Every FlexPanel object should have a unique ID. If its value is between FlexConstants.m_nUserDefinedControlStartID and FlexConstants.m_nUserDefinedControlStartID, then its layout will be persistent; otherwise, its layout will not be saved.

2)   public virtual FLEX_DOCKING_ALIGN FlexDock { get; set; }
Remarks
Gets or sets which control borders are docked to its parent control and determines how a control is resized with its parent. It can be one of the following values,
§         NONE:             
The control is not docked.
§         TOP:                
The control's top edge is docked to the top of its containing control.
§         BOTTOM:         
The control's bottom edge is docked to the bottom of its containing control.
§         LEFT:              
The control's left edge is docked to the left edge of its containing control.
§         RIGHT:             
The control's right edge is docked to the right edge of its containing control.

§      Methods
1)  public void ShowPanel()              
Remarks
This make the FlexPanel object visible.

2)   public virtual void HidePanel()
Remarks
This make the FlexPanel object invisible.

3)  public void InsertToolStrip(
FlexToolStrip toolstrip,
int nRowIndex,
int nColIndex)               
Parameters
toolstrip
Type: FlexToolStrip
The toolbar is going to be added into the panel.

nRowIndex
Type: int
The index of the row that the toolbar will be inserted.

nColIndex
Type: int
The index of the column that the toolbar will be inserted.

Remarks
This adds a toolbar into the panel.

Example:
public class MyToolbar: FlexToolStrip
{
    // ***** //
}

public class MyPanel: FlexPanel
{
    // ***** //
}

public class MDIForm : FlexMDIForm
{
    // ***** //
}
public MDIForm ()
{
SuspendLayout();
InitializeComponent();

// Create a toolbar.
MyToolbar myToolbar =  new MyToolbar();
// Assign a unique ID which is between FlexConstants.m_nUserDefinedControlStartID and
// FlexConstants.m_nUserDefinedControlEndID
myToolbar.ID = FlexConstants.m_nUserDefinedControlStartID + 1;
// Show the toolbar.
myToolbar.ShowToolStrip();

// Create a panel.
MyPanel myPanel =  new MyPanel();
// Assign a unique ID which is between FlexConstants.m_nUserDefinedControlStartID and
// FlexConstants.m_nUserDefinedControlEndID
myPanel.ID = FlexConstants.m_nUserDefinedControlStartID + 2;
// Show the panel.
myPanel.ShowPanel();
// Insert the toolbar into the panel at row 0, column 0
myPanel.InsertToolStrip( myToolbar, 0, 0 ); 

ResumeLayout( false );
PerformLayout();
}

4)  public void SetMenuStripp(
LinsMenuStrip menustrip)                
Parameters
menustrip
Type: LinsMenuStrip
The menu bar will be set as the main menu of the panel.

Remarks
This adds a menubar into the panel.

Example:
public class MyMenubar: LinsMenuStrip
{
    // ***** //
}

public class MyPanel: FlexPanel
{
    // ***** //
}

public class MDIForm : FlexMDIForm
{
    // ***** //
}

public MDIForm ()
{
SuspendLayout();
InitializeComponent();

// Create a menu bar.
MyMenubar myMenubar = new MyMenubar();
// Assign a unique ID which is between FlexConstants.m_nUserDefinedControlStartID and
// FlexConstants.m_nUserDefinedControlEndID
myMenubar.ID = FlexConstants.m_nUserDefinedControlStartID + 1;
// Show the menu bar.
myMenubar.ShowMenuStrip();

// Create a panel.
MyPanel myPanel = new MyPanel();
// Assign a unique ID which is between FlexConstants.m_nUserDefinedControlStartID and
// FlexConstants.m_nUserDefinedControlEndID
myPanel.ID = FlexConstants.m_nUserDefinedControlStartID + 2;
// Show the panel.
myPanel.ShowPanel();
// Set the menubar as the menu of the panel
myPanel.SetMenuStrip( myMenubar ); 

ResumeLayout( false );
PerformLayout();
}

No comments:

Post a Comment