Table of Contents

Method Percent

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

Percent(int, DimPercentMode)

Creates a percentage Dim object that is a percentage of the width or height of the SuperView.

public static Dim? Percent(int percent, DimPercentMode mode = DimPercentMode.ContentSize)

Parameters

percent int

A value between 0 and 100 representing the percentage.

mode DimPercentMode

the mode. Defaults to ContentSize.

Returns

Dim

The percent Dim object.

Examples

This initializes a TextField that will be centered horizontally, is 50% of the way down, is 30% the height, and is 80% the width of the SuperView.

var textView = new TextField {
   X = Pos.Center (),
   Y = Pos.Percent (50),
   Width = Dim.Percent (80),
   Height = Dim.Percent (30),
};