Table of Contents

Class Border

Namespace
Terminal.Gui.ViewBase
Assembly
Terminal.Gui.dll

The lightweight Border settings for a View. Accessed via Border. Stores Thickness, LineStyle, and Settings without creating a full View unless rendering, arrangement, or SubViews require it.

public class Border : AdornmentImpl, IAdornment
Inheritance
Border
Implements
Inherited Members

Remarks

Border is one of three adornment layers (Margin → Border → Padding) that surround a View's content area. It renders a border frame around the view using LineStyle line-drawing glyphs, and can display the Title either inline on the border or in a tab header.

The rendering layer (BorderView) is created lazily via GetOrCreateView() when LineStyle, Thickness, or Tab is set.

The Border also provides keyboard and mouse support for moving and resizing the View via ViewArrangement. See the Arrangement Deep Dive.

BorderStyle is a convenience helper that sets LineStyle and Thickness atomically; use Border directly for advanced configuration.

See https://gui-cs.github.io/Terminal.Gui/docs/borders.html for the full deep dive.

Standard border with title (BorderStyle = LineStyle.Single, Thickness.Top == 1):
<pre><code class="lang-csharp">┌┤Title├──┐

│ │ └─────────┘

Rounded border with thick top (<code>BorderStyle = LineStyle.Rounded</code>, <code>Thickness.Top == 3</code>):

<pre><code class="lang-csharp"> ╭─────╮

╭┤Title├──╮ │╰─────╯ │ │ │ ╰─────────╯

Tab-style border (<code>Settings = BorderSettings.Tab | BorderSettings.Title</code>,
<code>TabSide = Side.Top</code>, <code>Thickness = new (1, 3, 1, 1)</code>):

<pre><code class="lang-csharp">╭───╮           ╭───╮

│Tab│ │Tab│ ├───┴───╮ │ ╰───╮ │content│ │content│ ╰───────╯ ╰───────╯ (unfocused) (focused)

Constructors

Border()

Properties

LineStyle

Gets or sets the style of the lines drawn in the Border.

Settings

Gets or sets the BorderSettings flags that control rendering behavior.

Methods

CreateView()

Factory method — subclasses return their specific AdornmentView subclass.

GetFrame()

The calculated frame rectangle for this adornment layer, set by Terminal.Gui.ViewBase.View.SetAdornmentFrames. This is the single source of truth for adornment geometry.

OnThicknessChanged()

Called when Thickness changes. Override in subclasses to react; base is empty.