WinForms

Code Examples Upgrade Guide User Guide Demos Support Forums Download
  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class BorderLayout

    Show / Hide Table of Contents

    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.

    Inheritance
    System.Object
    LayoutManager
    BorderLayout
    Implements
    System.ComponentModel.IExtenderProvider
    ILayoutManager
    System.ComponentModel.ISupportInitialize
    Inherited Members
    LayoutManager.initializing
    LayoutManager.preferredSizes
    LayoutManager.minimumSizes
    LayoutManager.MakeDirty()
    LayoutManager.OnContainerControlChanged(EventArgs)
    LayoutManager.ResetCustomLayoutBounds()
    LayoutManager.ShouldSerializeCustomLayoutBounds()
    LayoutManager.Dispose(Boolean)
    LayoutManager.BeginInit()
    LayoutManager.EndInit()
    LayoutManager.CanExtend(Object)
    LayoutManager.SetPreferredSize(Control, Size)
    LayoutManager.ForcePreferredAndMinimumsSize()
    LayoutManager.ShouldSerializePreferredSize(Control)
    LayoutManager.ResetPreferredSize(Control)
    LayoutManager.GetStaticMinimumSize(Control)
    LayoutManager.SetMinimumSize(Control, Size)
    LayoutManager.ShouldSerializeMinimumSize(Control)
    LayoutManager.ResetMinimumSize(Control)
    LayoutManager.GetDynamicSize(Control, LayoutInformationType, Size)
    LayoutManager.OnProvideLayoutInformation(ProvideLayoutInformationEventArgs)
    LayoutManager.OnControlAdded(Object, ControlEventArgs)
    LayoutManager.OnControlRemoved(Object, ControlEventArgs)
    LayoutManager.OnDockStyleChanged(Object, EventArgs)
    LayoutManager.ResetLayoutInfo()
    LayoutManager.GetControls()
    LayoutManager.GetBounds()
    LayoutManager.AdjustHeightForMargins(Int32)
    LayoutManager.AdjustWidthForMargins(Int32)
    LayoutManager.IsVisible(Control)
    LayoutManager.IsInit()
    LayoutManager.GetAutoLabel(Control)
    LayoutManager.ShouldLayoutAutoLabel(AutoLabel)
    LayoutManager.LoadingDocument
    LayoutManager.DesignerInTransaction
    LayoutManager.DesignerHost
    LayoutManager.ComponentDesigner
    LayoutManager.ContainerControl
    LayoutManager.CustomLayoutBounds
    LayoutManager.UseControlCollectionPosition
    LayoutManager.LayoutControls
    LayoutManager.AutoLayout
    LayoutManager.LeftMargin
    LayoutManager.HorzNearMargin
    LayoutManager.RightMargin
    LayoutManager.HorzFarMargin
    LayoutManager.TopMargin
    LayoutManager.BottomMargin
    LayoutManager.ContainerControlChanged
    LayoutManager.ProvideLayoutInformation
    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
    LayoutManager.AddLayoutComponent(Control, Object)

    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
    LayoutManager.GetMinimumSize(Control)

    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
    LayoutManager.GetPreferredSize(Control)

    GetStaticPreferredSize(Control)

    Declaration
    protected override Size GetStaticPreferredSize(Control control)
    Parameters
    Type Name Description
    System.Windows.Forms.Control control
    Returns
    Type Description
    System.Drawing.Size
    Overrides
    LayoutManager.GetStaticPreferredSize(Control)

    LayoutContainer()

    Triggers a layout of the child components. LayoutContainer()

    Declaration
    public override void LayoutContainer()
    Overrides
    LayoutManager.LayoutContainer()

    MinimumLayoutSize()

    Returns the minimum size for the ContainerControl. MinimumLayoutSize()

    Declaration
    public override Size MinimumLayoutSize()
    Returns
    Type Description
    System.Drawing.Size
    Overrides
    LayoutManager.MinimumLayoutSize()

    PreferredLayoutSize()

    Returns the preferred size for the ContainerControl. PreferredLayoutSize()

    Declaration
    public override Size PreferredLayoutSize()
    Returns
    Type Description
    System.Drawing.Size
    Overrides
    LayoutManager.PreferredLayoutSize()

    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
    LayoutManager.RemoveLayoutComponent(Control)

    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.

    Implements

    System.ComponentModel.IExtenderProvider
    ILayoutManager
    System.ComponentModel.ISupportInitialize
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved