Class BorderLayout
Represents the LayoutManager that lays out the children along the borders and at the center, very similar to the Windows Form's control docking behavior.
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Tools
Assembly: Syncfusion.Shared.Base.dll
Syntax
public class BorderLayout : LayoutManager, IExtenderProvider, ILayoutManager, ISupportInitialize
Remarks
This LayoutManager will dock up to five controls along the four borders and the center. This is very similar to the control docking behavior exhibited by the System.Windows.Forms.DockStyle setting of a control.
The GetPosition(Control) and SetPosition(Control, BorderPosition) methods let you specify a BorderPosition for a child control and also act as an extended property during design-time for the child controls.
Here are some of the differences between Windows Forms style docking and the BorderLayout.
- When using BorderLayout, there can be only a single control that can be docked to a border.
- When using BorderLayout and the CustomLayoutBounds setting, the bounds for layout can be customized to be something different from the control's client rectangle.
- Just like our other LayoutManagers, you can layout non-control based items when using the BorderLayout.
Examples
Here is some sample code that tells you how to initialize a BorderLayout manager.
// Binding a control to the BorderLayout manager programmatically.
this.borderLayout1 = new BorderLayout();
this.borderLayout1.ContainerControl = this;
// Set the border-position of the button.
this.borderLayout1.SetPosition(this.btnNorth, BorderPosition.North);
this.borderLayout1.SetPosition(this.btnSouth, BorderPosition.South);
this.borderLayout1.SetPosition(this.btnCenter, BorderPosition.Center);
this.borderLayout1.SetPosition(this.btnEast, BorderPosition.East);
this.borderLayout1.SetPosition(this.btnWest, BorderPosition.West);</code></pre>
Also, take a look at the project in Tools/Samples/Layout Manager Package/LayoutManager for an example.
Constructors
BorderLayout()
Overloaded. Creates an instance of the BorderLayout class and sets its defaults.
Declaration
public BorderLayout()
BorderLayout(IContainer)
Creates an instance of the BorderLayout class and sets its System.Windows.Forms.ContainerControl.
Declaration
public BorderLayout(IContainer container)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.IContainer | container |
BorderLayout(Control)
Creates an instance of the BorderLayout class and sets its Control.
Declaration
public BorderLayout(Control container)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | container |
BorderLayout(Control, Int32, Int32)
Creates an instance of the BorderLayout class and sets its Control, VGap and HGap.
Declaration
public BorderLayout(Control container, int vGap, int hGap)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | container | |
System.Int32 | vGap | |
System.Int32 | hGap |
Properties
HGap
Gets or sets the horizontal spacing between the layout border and the components.
Declaration
public int HGap { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The horizontal space in pixels. |
VGap
Gets or sets the vertical spacing between the layout border and the components.
Declaration
public int VGap { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The vertical space in pixels. |
Methods
AddLayoutComponent(Control, Object)
Adds a child component to the layout list with the specified constraints. AddLayoutComponent(Control, Object)
Declaration
public override void AddLayoutComponent(Control childControl, object constraints)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | childControl | The childcontrol which is added to the layout |
System.Object | constraints | The BorderPosition |
Overrides
GetMinimumSize(Control)
Retrieves the minimum size associated with the specified control. GetMinimumSize(Control)
Declaration
public override Size GetMinimumSize(Control control)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control | The control whose minimum size is to be retrieved |
Returns
Type | Description |
---|---|
System.Drawing.Size | Returns the MinimumSize of the control |
Overrides
GetPosition(Control)
Returns the BorderPosition of a child component.
Declaration
public BorderPosition GetPosition(Control control)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control | The child component whose position is to be retrieved. |
Returns
Type | Description |
---|---|
BorderPosition | The BorderPosition. |
GetPreferredSize(Control)
Retrieves the preferred size associated with the specified control. GetPreferredSize(Control)
Declaration
public override Size GetPreferredSize(Control control)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control | The control whose perferred size is to be retrieved |
Returns
Type | Description |
---|---|
System.Drawing.Size | Returns the PreferredSize of the control |
Overrides
GetStaticPreferredSize(Control)
Declaration
protected override Size GetStaticPreferredSize(Control control)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control |
Returns
Type |
---|
System.Drawing.Size |
Overrides
LayoutContainer()
Triggers a layout of the child components. LayoutContainer()
Declaration
public override void LayoutContainer()
Overrides
MinimumLayoutSize()
Returns the minimum size for the ContainerControl. MinimumLayoutSize()
Declaration
public override Size MinimumLayoutSize()
Returns
Type |
---|
System.Drawing.Size |
Overrides
PreferredLayoutSize()
Returns the preferred size for the ContainerControl. PreferredLayoutSize()
Declaration
public override Size PreferredLayoutSize()
Returns
Type |
---|
System.Drawing.Size |
Overrides
RemoveLayoutComponent(Control)
Removes a child component from the layout list. RemoveLayoutComponent(Control)
Declaration
public override void RemoveLayoutComponent(Control childControl)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | childControl | The childcontrol which is need to remove from layout |
Overrides
SetPosition(Control, BorderPosition)
Sets the BorderPosition for a child component.
Declaration
public void SetPosition(Control control, BorderPosition position)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control | The child component whose position is to be set. |
BorderPosition | position | The BorderPosition. |