Token导航 LogoToken导航TokenDH.com
前端设计只读github未标认证来源可访问许可证需确认审计通过

syncfusion-winforms-layout-managersSynfusion Winforms 布局管理器

Agent Skill

用于辅助界面设计、视觉规范、排版、配色、布局和交互体验优化。它适合让 Agent 根据产品场景整理页面结构、生成 UI 方案、检查视觉一致性或改进组件层级。使用时需要结合现有品牌、设计系统和用户任务,不应只堆装饰元素;涉及真实页面改动时,应通过截图或浏览器预览检查文本溢出、对齐和响应式表现。

总安装

720

周安装

30

GitHub Stars

1

下载量

240
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:syncfusion-winforms-layout-managers(Synfusion Winforms 布局管理器)
来源仓库:https://github.com/syncfusion/winforms-ui-components-skills
仓库路径:skills/syncfusion-winforms-layout-managers
安装命令:
npx skills add https://github.com/syncfusion/winforms-ui-components-skills --skill syncfusion-winforms-layout-managers
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

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

简介

整合多种经典布局策略的管理套件,满足不同复杂度的界面编排需求。

  • 适合需要同时处理流式、锚定、表格等多种布局混合使用的项目。
  • AI 宿主可利用该技能智能推荐最优布局方案,辅助架构决策过程。
  • 混用不同管理器时务必注意 Z-Order 与事件冒泡顺序,避免交互异常。
  • 长期维护项目建议建立布局规范文档,确保团队间实现一致性。

SKILL.md

Implementing Syncfusion WinForms LayoutManagers

The LayoutManagers Package provides five specialized layout managers that automatically arrange child controls within container controls (Panel, Form, etc.) based on specific layout strategies. These managers eliminate manual positioning and provide professional, maintainable layouts.

When to Use This Skill

Use this skill when the user needs to:

  • Automatic Layout Management: Let layout managers position controls instead of manual placement
  • BorderLayout (5-Region Docking): Dock controls to North, South, East, West, or Center positions
  • CardLayout (Wizard/Property Pages): Show one control at a time in a stack (wizards, tabbed content)
  • FlowLayout (Flow Arrangement): Arrange controls horizontally or vertically with automatic wrapping
  • GridLayout (Uniform Grid): Position controls in a uniform grid with equal-sized cells
  • GridBagLayout (Flexible Grid): Create complex layouts with variable cell sizes and control spanning
  • Container-Based Layouts: Apply layouts to Panel, Form, or any ContainerControl
  • Constraint-Based Positioning: Define layout rules instead of absolute coordinates
  • Responsive Layouts: Layouts that adapt when container resizes
  • Professional Forms: Create consistent, maintainable form layouts

Component Overview

The LayoutManagers Package (Syncfusion.Windows.Forms.Tools) provides five layout managers:

1. BorderLayout

Purpose: Dock controls along borders and center (like.NET docking)

Key Features:

  • 5 regions: North, South, East, West, Center
  • Position-based constraints
  • Spacing control (HGap, VGap)
  • Size customization per position

When to use: MDI-style interfaces, dock panels, application shells with header/footer/sidebar

2. CardLayout

Purpose: Show one child control at a time from a stack

Key Features:

  • Stack of cards (only one visible)
  • Navigation (First, Last, Next, Previous)
  • Card naming/identification
  • Layout modes (Default, Fill)
  • Image support per card

When to use: Wizards, property pages, tabbed content without tabs, step-by-step forms

3. FlowLayout

Purpose: Arrange controls in horizontal or vertical flow (MOST COMMONLY USED)

Key Features:

  • Horizontal or vertical layout modes
  • Automatic wrapping
  • Alignment options (Near, Far, Center, ChildConstraints)
  • Per-child constraints (MinSize, PreferredSize)
  • Flow direction (normal, reverse)
  • AutoHeight feature

When to use: Toolbars, button panels, tag lists, responsive content, most general-purpose layouts

4. GridLayout

Purpose: Position controls in a uniform grid

Key Features:

  • Rows and columns configuration
  • Equal-sized cells
  • Automatic child placement
  • Spacing control (HGap, VGap)

When to use: Calculator layouts, button grids, uniform icon panels, simple tabular layouts

5. GridBagLayout

Purpose: Create complex layouts with flexible grid

Key Features:

  • Variable row/column sizes
  • Cell spanning (row and column)
  • Anchor positions (9 options)
  • Fill modes (None, Horizontal, Vertical, Both)
  • Weight-based resizing (WeightX, WeightY)
  • Per-cell padding (Insets)

When to use: Complex forms, dialog boxes, layouts with variable cell sizes, advanced positioning requirements

Key Namespace: Syncfusion.Windows.Forms.Tools

Assembly: Syncfusion.Shared.Base.dll


Documentation and Navigation Guide

Getting Started

📄 Read: references/getting-started.md

When to read: User needs to install, understand container concepts, or set up their first layout manager.

Topics covered:

  • Assembly deployment and NuGet packages
  • Container control concept (Panel, Form, ContainerControl)
  • Child control management
  • Adding layout managers via designer
  • Adding layout managers via code
  • Basic setup for all layout types
  • Common settings (spacing, gaps)
  • Layout events

BorderLayout (5-Region Docking)

📄 Read: references/border-layout.md

When to read: User wants to dock controls to borders (North, South, East, West, Center).

Topics covered:

  • BorderLayout overview and position constraints
  • Adding controls to each position
  • Designer vs code approaches
  • SetConstraints method
  • Spacing configuration (HGap, VGap)
  • Size customization per position
  • MDI-style layout example
  • Dock panel example
  • Best practices for border layouts

CardLayout (Wizard/Stack)

📄 Read: references/card-layout.md

When to read: User needs wizards, property pages, or stack-based navigation.

Topics covered:

  • CardLayout overview (one visible card at a time)
  • Card naming and identification
  • Navigation methods (First, Last, Next, Previous, ActivateCard)
  • LayoutMode (Default, Fill)
  • Image settings per card
  • Designer usage (SelectedCard property)
  • Programmatic card management
  • Wizard control implementation
  • Property page implementation
  • Complete wizard example
  • Best practices

FlowLayout (Flow Arrangement)

📄 Read: references/flow-layout.md

When to read: User needs horizontal/vertical flow layouts (MOST COMMON use case).

Topics covered:

  • FlowLayout overview (most versatile)
  • LayoutMode (Horizontal, Vertical)
  • Flow direction (normal, reverse)
  • Alignment options (Near, Far, Center, ChildConstraints)
  • AutoHeight feature for wrapping
  • HGap and VGap spacing
  • Per-child constraints (MinSize, PreferredSize)
  • SetConstraints method
  • Wrapping behavior
  • Horizontal toolbar example
  • Vertical sidebar example
  • Tag list example
  • Advanced constraint scenarios
  • Best practices

GridLayout (Uniform Grid)

📄 Read: references/grid-layout.md

When to read: User needs uniform grid with equal-sized cells.

Topics covered:

  • GridLayout overview
  • Rows and Columns configuration
  • Automatic child placement order
  • HGap and VGap spacing
  • Designer vs code approaches
  • Grid sizing behavior
  • Calculator layout example
  • Button grid example
  • Best practices

GridBagLayout (Flexible Grid)

📄 Read: references/grid-bag-layout.md

When to read: User needs complex layouts with variable cell sizes and control spanning.

Topics covered:

  • GridBagLayout overview (most powerful)
  • Virtual grid concept (variable row/column sizes)
  • GridBagConstraints configuration
  • Anchor property (North, South, East, West, Center, NorthEast, NorthWest, SouthEast, SouthWest)
  • Fill property (None, Horizontal, Vertical, Both)
  • CellSpan (RowSpan, ColSpan)
  • WeightX and WeightY (resize distribution)
  • Insets (cell padding)
  • Form layout example
  • Calculator layout example
  • Advanced spanning scenarios
  • Best practices

Layout Type Selection Guide

Choose your layout based on requirements:

RequirementRecommended LayoutWhy
Dock to borders (header/footer/sidebar)BorderLayoutSimple 5-region positioning
Wizard or multi-step formCardLayoutOne visible card at a time with navigation
Horizontal button toolbarFlowLayout (Horizontal)Auto-wrapping, flexible spacing
Vertical sidebar or listFlowLayout (Vertical)Auto-wrapping, flexible spacing
Calculator or keypadGridLayout or GridBagLayoutUniform grid or flexible grid
Complex form with labels/fieldsGridBagLayoutVariable cell sizes, spanning, alignment
Simple tabular layout (equal cells)GridLayoutUniform rows and columns
General-purpose responsive layoutFlowLayoutMost versatile, widely applicable

Quick Start Examples

BorderLayout: Dock to Borders

using Syncfusion.Windows.Forms.Tools;

// Create BorderLayout
BorderLayout borderLayout = new BorderLayout();
borderLayout.ContainerControl = panel1; // Panel as container

// Create controls for each position
Label northLabel = new Label { Text = "Header", BackColor = Color.LightBlue };
Label southLabel = new Label { Text = "Footer", BackColor = Color.LightGray };
Label eastLabel = new Label { Text = "Right", BackColor = Color.LightYellow };
Label westLabel = new Label { Text = "Left", BackColor = Color.LightGreen };
Panel centerPanel = new Panel { BackColor = Color.White };

// Add controls to container
panel1.Controls.Add(northLabel);
panel1.Controls.Add(southLabel);
panel1.Controls.Add(eastLabel);
panel1.Controls.Add(westLabel);
panel1.Controls.Add(centerPanel);

// Set constraints (position each control)
borderLayout.SetPosition(northLabel, BorderPosition.North)
borderLayout.SetPosition(southLabel, BorderPosition.South);
borderLayout.SetPosition(eastLabel, BorderPosition.East);
borderLayout.SetPosition(westLabel, BorderPosition.West);
borderLayout.SetPosition(centerPanel, BorderPosition.Center);

// Configure spacing
borderLayout.HGap = 5;
borderLayout.VGap = 5;

CardLayout: Wizard Pages

// Create CardLayout
CardLayout cardLayout = new CardLayout();
cardLayout.ContainerControl = panel1;

// Create wizard pages
Panel page1 = new Panel { BackColor = Color.AliceBlue };
Label label1 = new Label { Text = "Step 1: Welcome", Dock = DockStyle.Fill };
page1.Controls.Add(label1);

Panel page2 = new Panel { BackColor = Color.Honeydew };
Label label2 = new Label { Text = "Step 2: Configure", Dock = DockStyle.Fill };
page2.Controls.Add(label2);

Panel page3 = new Panel { BackColor = Color.LavenderBlush };
Label label3 = new Label { Text = "Step 3: Finish", Dock = DockStyle.Fill };
page3.Controls.Add(label3);

// Add pages to container
panel1.Controls.Add(page1);
panel1.Controls.Add(page2);
panel1.Controls.Add(page3);

// Name each card
cardLayout.SetCardName(page1, "Welcome");
cardLayout.SetCardName(page2, "Configure");
cardLayout.SetCardName(page3, "Finish");

// Navigation
cardLayout.LayoutMode = CardLayoutMode.Fill; // Fill container
cardLayout.First();  // Show first card

// Navigate programmatically
// cardLayout.Next();   // Next card
// cardLayout.Previous(); // Previous card
// cardLayout.ActivateCard("Configure"); // Jump to specific card

FlowLayout: Horizontal Toolbar

// Create FlowLayout
FlowLayout flowLayout = new FlowLayout();
flowLayout.ContainerControl = panel1;
flowLayout.LayoutMode = FlowLayoutMode.Horizontal;
flowLayout.Alignment = FlowAlignment.Near;
flowLayout.HGap = 10;
flowLayout.VGap = 5;

// Add buttons
for (int i = 1; i <= 8; i++)
{
    Button btn = new Button { Text = $"Button {i}", Size = new Size(80, 30) };
    panel1.Controls.Add(btn);
}

// Buttons will flow horizontally and wrap to next line automatically

GridLayout: Button Grid

// Create GridLayout (3x3 grid)
GridLayout gridLayout = new GridLayout();
gridLayout.ContainerControl = panel1;
gridLayout.Rows = 3;
gridLayout.Columns = 3;
gridLayout.HGap = 5;
gridLayout.VGap = 5;

// Add 9 buttons (automatic placement in grid)
for (int i = 1; i <= 9; i++)
{
    Button btn = new Button { Text = i.ToString() };
    panel1.Controls.Add(btn);
}

GridBagLayout: Form Layout

// Create GridBagLayout
GridBagLayout gridBagLayout = new GridBagLayout();
gridBagLayout.ContainerControl = panel1;

// Create form controls
Label nameLabel = new Label { Text = "Name:", AutoSize = true };
TextBox nameTextBox = new TextBox { Width = 200 };
Label emailLabel = new Label { Text = "Email:", AutoSize = true };
TextBox emailTextBox = new TextBox { Width = 200 };
Button submitButton = new Button { Text = "Submit" };

// Add to container
panel1.Controls.Add(nameLabel);
panel1.Controls.Add(nameTextBox);
panel1.Controls.Add(emailLabel);
panel1.Controls.Add(emailTextBox);
panel1.Controls.Add(submitButton);

// Create constraints
GridBagConstraints labelConstraints = new new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, AnchorTypes.East, FillType.Horizontal, new Insets(5,5,5,5), 0, 0, false);
labelConstraints.Anchor = GridBagAnchor.East; // Align right

GridBagConstraints fieldConstraints = new GridBagConstraints(1, 0, 1, 1);
fieldConstraints.Fill = GridBagFill.Horizontal;
fieldConstraints.WeightX = 1; // Take extra horizontal space

// Apply constraints
gridBagLayout.SetConstraints(nameLabel, new new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, AnchorTypes.East, FillType.Horizontal, new Insets(5,5,5,5), 0, 0, false));
gridBagLayout.SetConstraints(nameTextBox, new new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, AnchorTypes.East, FillType.Horizontal, new Insets(5,5,5,5), 0, 0, false) {WeightX = 1 });
gridBagLayout.SetConstraints(emailLabel, new new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, AnchorTypes.East, FillType.Horizontal, new Insets(5,5,5,5), 0, 0, false));
gridBagLayout.SetConstraints(emailTextBox, new new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, AnchorTypes.East, FillType.Horizontal, new Insets(5,5,5,5), 0, 0, false){ WeightX = 1 });
gridBagLayout.SetConstraints(submitButton, new new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, AnchorTypes.East, FillType.Horizontal, new Insets(5,5,5,5), 0, 0, false));

Common Patterns

Application Shell (BorderLayout)

// Header + Footer + Sidebar + Content area
BorderLayout borderLayout = new BorderLayout();
borderLayout.ContainerControl = this; // Form as container
borderLayout.HGap = 0;
borderLayout.VGap = 0;

Panel header = new Panel { Height = 60, BackColor = Color.Navy };
Panel footer = new Panel { Height = 30, BackColor = Color.Gray };
Panel sidebar = new Panel { Width = 200, BackColor = Color.LightGray };
Panel content = new Panel { BackColor = Color.White };

this.Controls.AddRange(new Control[] { header, footer, sidebar, content });

borderLayout.SetPosition(header, BorderPosition.North);
borderLayout.SetPosition(footer, BorderPosition.South);
borderLayout.SetPosition(sidebar, BorderPosition.West);
borderLayout.SetPosition(content, BorderPosition.Center);

When to use: Main application window with fixed header/footer and sidebar.

Multi-Step Wizard (CardLayout)

See Quick Start example above. Add Next/Previous buttons to navigate between wizard steps.

Responsive Toolbar (FlowLayout)

See Quick Start example above. Buttons automatically wrap when window resizes.

Login Form (GridBagLayout)

// Labels in column 0, fields in column 1
// Submit button spans both columns
// All elements properly aligned and spaced

See GridBagLayout reference for complete example.


Key Properties

Common to All Layouts

PropertyTypeDescription
ContainerControlControlContainer (Panel, Form) where layout is applied

BorderLayout

PropertyTypeDescription
HGapintHorizontal gap between regions
VGapintVertical gap between regions

CardLayout

PropertyTypeDescription
LayoutModeCardLayoutModeDefault or Fill
SelectedCardControlCurrently visible card (designer)

FlowLayout

PropertyTypeDescription
LayoutModeFlowLayoutModeHorizontal or Vertical
AlignmentFlowAlignmentNear, Far, Center, ChildConstraints
ReverseRowsboolReverse flow direction
AutoHeightboolAuto-adjust height for wrapping
HGapintHorizontal gap between controls
VGapintVertical gap between controls

GridLayout

PropertyTypeDescription
RowsintNumber of rows
ColumnsintNumber of columns
HGapintHorizontal gap between cells
VGapintVertical gap between cells

GridBagLayout

PropertyTypeDescription
*(Constraints set per child)*GridBagConstraintsSee GridBagLayout reference

Common Use Cases

1. Application Main Window

Scenario: Header, footer, sidebar, content area.

  • Use BorderLayout
  • North: Header, South: Footer, West: Sidebar, Center: Content
  • Read: border-layout.md

2. Setup Wizard

Scenario: Multi-step configuration wizard.

  • Use CardLayout
  • Each card is one step, navigate with Next/Previous buttons
  • Read: card-layout.md

3. Toolbar with Auto-Wrapping

Scenario: Horizontal toolbar that wraps to next line.

  • Use FlowLayout (Horizontal mode)
  • Set AutoHeight = true
  • Read: flow-layout.md

4. Calculator Keypad

Scenario: 4x4 button grid.

5. Data Entry Form

Scenario: Labels on left, fields on right.

  • Use GridBagLayout
  • Column 0: Labels (right-aligned), Column 1: Fields (fill horizontal)
  • Read: grid-bag-layout.md

6. Tag Cloud

Scenario: Tags that flow and wrap.

  • Use FlowLayout (Horizontal mode)
  • Add Label controls dynamically
  • Read: flow-layout.md

Events

Common layout event:

  • LayoutComplete - Raised when layout recalculation is complete
flowLayout.LayoutComplete += (sender, e) => {
    // Layout has been recalculated
};

Best Practices

  1. Layout Selection: Use the selection guide above to choose the right layout type
  2. Container Requirements: Always set ContainerControl property (Panel, Form)
  3. Child Addition Order: Add children to container BEFORE setting constraints
  4. FlowLayout for Most Cases: When in doubt, start with FlowLayout (most versatile)
  5. GridBagLayout for Complex Forms: Use for professional data entry forms
  6. Spacing Consistency: Use HGap/VGap for consistent spacing
  7. Designer Support: Use designer for rapid prototyping, code for dynamic layouts
  8. Constraint Objects: Reuse GridBagConstraints objects for similar controls
  9. Testing Resize: Always test layouts with different container sizes
  10. Documentation: Comment constraint configurations for maintainability

See Also

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.05%
按下载量换算87

Claude

28.99%
按下载量换算70

Cursor

18.49%
按下载量换算44

Gemini CLI

9.26%
按下载量换算22

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills