mcpField
S
syncfusion-winforms-border-layout

syncfusion-winforms-border-layout

github.com/syncfusionDesign & UI281 installsUpdated 1w ago
Repository

About syncfusion-winforms-border-layout

syncfusion-winforms-border-layout is a skill for arranging Windows Forms child controls with Syncfusion’s BorderLayout. It documents five border and center positions, spacing controls, and designer-based or programmatic setup in C# and VB.NET.

Key features

  1. 01North, South, East, West, and Center positions
  2. 02Horizontal and vertical gap settings
  3. 03Visual Studio designer setup
  4. 04Programmatic C# and VB.NET setup
  5. 05Container control configuration

Use cases

  1. 01Building a header, content, and footer layout
  2. 02Placing a sidebar beside main content
  3. 03Arranging controls around a center area
  4. 04Adjusting spacing between controls

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/syncfusion/winforms-ui-components-skills --skill syncfusion-winforms-border-layout

After installing, type/syncfusion-winforms-border-layoutin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
getting-started.md
layout-patterns.md
positioning-controls.md
spacing-configuration.md

Details

From the project README

Implementing Syncfusion Windows Forms BorderLayout

BorderLayout is a Windows Forms layout manager that allows you to arrange and layout child controls along the borders (North, South, East, West) to the center, similar to .NET framework's built-in docking support. Unlike automatic layout managers, BorderLayout gives you explicit control over positioning.

When to Use This Skill

  • Layout with border regions: When you need to arrange controls along borders and a center area
  • Top/bottom headers/footers: When you want a fixed header (North) and footer (South) with content in between
  • Left/right sidebars: When you need a sidebar panel on the left or right with main content in the center
  • Spacing control: When you need precise spacing between controls using HGap and VGap
  • Designer or code-based layouts: Whether building UI in designer or programmatically in C#/VB.NET
  • Alternative to docking: When you want a more structured approach than Windows Forms docking

Component Overview

Key Features:

  • 5-position layout: North, South, East, West, Center positions for child controls
  • Spacing configuration: Customize horizontal (HGap) and vertical (VGap) gaps between controls
  • Designer support: Add BorderLayout and child controls via Visual Studio designer
  • Code-based creation: Programmatically create and configure BorderLayout in C# or VB.NET
  • Container control: Set any control (typically a Form) as the container for BorderLayout

Documentation Navigation Guide

Getting Started

📄 Read: references/getting-started.md

  • Assembly and NuGet package setup
  • Creating BorderLayout in designer
  • Creating BorderLayout via code (C# and VB.NET)
  • Adding child controls
  • Container setup
Positioning Controls

📄 Read: references/positioning-controls.md

  • Setting control positions (North, South, East, West, Center)
  • SetPosition() method usage
  • BorderPosition enumeration
  • Multiple controls at the same position
  • Code examples for each position
  • Common position configurations
Spacing Configuration

📄 Read: references/spacing-configuration.md

  • HGap property (horizontal spacing)
  • VGap property (vertical spacing)
  • Setting spacing in designer
  • Setting spacing in code (C# and VB.NET)
  • Responsive spacing patterns
Layout Patterns

📄 Read: references/layout-patterns.md

  • Common layouts (header/footer, sidebars, multi-panel)
  • Best practices and patterns
  • Responsive considerations
  • When to use BorderLayout vs other approaches
  • Complete working examples

Quick Start

Here's a minimal BorderLayout setup:

using Syncfusion.Windows.Forms.Tools;

// In your form
BorderLayout borderLayout1 = new BorderLayout();
this.borderLayout1.ContainerControl = this;

// Add controls
ButtonAdv topButton = new ButtonAdv() { Text = "Header", Dock = DockStyle.Top };
ButtonAdv leftButton = new ButtonAdv() { Text = "Sidebar", Dock = DockStyle.Left };
ButtonAdv centerButton = new ButtonAdv() { Text = "Content", Dock = DockStyle.Fill };

this.Controls.Add(topButton);
this.Controls.Add(leftButton);
this.Controls.Add(centerButton);

// Set positions
borderLayout1.SetPosition(topButton, BorderPosition.North);
borderLayout1.SetPosition(leftButton, BorderPosition.West);
borderLayout1.SetPosition(centerButton, BorderPosition.Center);

// Configure spacing
borderLayout1.HGap = 10;
borderLayout1.VGap = 10;

VB.NET Equivalent:

Imports Syncfusion.Windows.Forms.Tools

' In your form
Dim borderLayout1 As BorderLayout = New BorderLayout()
Me.borderLayout1.ContainerControl = Me

' Add controls
Dim topButton As ButtonAdv = New ButtonAdv() With {.Text = "Header", .Dock = DockStyle.Top}
Dim leftButton As ButtonAdv = New ButtonAdv() With {.Text = "Sidebar", .Dock = DockStyle.Left}
Dim centerButton As ButtonAdv = New ButtonAdv() With {.Text = "Content", .Dock = DockStyle.Fill}

Me.Controls.Add(topButton)
Me.Controls.Add(leftButton)
Me.Controls.Add(centerButton)

' Set positions
borderLayout1.SetPosition(topButton, BorderPosition.North)
borderLayout1.SetPosition(leftButton, BorderPosition.West)
borderLayout1.SetPosition(centerButton, BorderPosition.Center)

' Configure spacing
borderLayout1.HGap = 10
borderLayout1.VGap = 10

Common Patterns

Pattern 1: Header + Content + Footer

The most common layout with fixed header, scrollable content area, and fixed footer.

// Create panels for header, content, footer
Panel headerPanel = new Panel() { Height = 50 };
Panel contentPanel = new Panel();
Panel footerPanel = new Panel() { Height = 40 };

// Add to form
this.Controls.Add(headerPanel);
this.Controls.Add(contentPanel);
this.Controls.Add(footerPanel);

// Position with BorderLayout
borderLayout1.SetPosition(headerPanel, BorderPosition.North);
borderLayout1.SetPosition(footerPanel, BorderPosition.South);
borderLayout1.SetPosition(contentPanel, BorderPosition.Center);
Pattern 2: Sidebar + Content

Left sidebar with main content area.

// Create sidebar and content panels
Panel sidebarPanel = new Panel() { Width = 200 };
Panel contentPanel = new Panel();

this.Controls.Add(sidebarPanel);
this.Controls.Add(contentPanel);

// Position
borderLayout1.SetPosition(sidebarPanel, BorderPosition.West);
borderLayout1.SetPosition(contentPanel, BorderPosition.Center);
Pattern 3: Multi-Edge Layout

Controls on multiple edges with center content.

Panel top = new Panel() { Height = 40 };
Panel bottom = new Panel() { Height = 40 };
Panel left = new Panel() { Width = 150 };
Panel right = new Panel() { Width = 150 };
Panel center = new Panel();

this.Controls.Add(top);
this.Controls.Add(bottom);
this.Controls.Add(left);
this.Controls.Add(right);
this.Controls.Add(center);

borderLayout1.SetPosition(top, BorderPosition.North);
borderLayout1.SetPosition(bottom, BorderPosition.South);
borderLayout1.SetPosition(left, BorderPosition.West);
borderLayout1.SetPosition(right, BorderPosition.East);
borderLayout1.SetPosition(center, BorderPosition.Center);

Key Properties

PropertyTypeDescription
ContainerControlControlThe control that acts as the container for BorderLayout
HGapintHorizontal spacing between controls
VGapintVertical spacing between controls

Key Methods

MethodParametersDescription
SetPosition()Control, BorderPositionSets the border position for a child control

Supported Positions (BorderPosition enum)

  • North - Top of the layout
  • South - Bottom of the layout
  • East - Right side of the layout
  • West - Left side of the layout
  • Center - Center area (fills remaining space)

Comments

Markdown supported