Show / Hide Table of Contents

Class Pos

Describes a position which can be an absolute value, a percentage, centered, or relative to the ending dimension. Integer values are implicitly convertible to an absolute Pos. These objects are created using the static methods Percent, AnchorEnd and Center. The Pos objects can be combined with the addition and subtraction operators.

Inheritance
System.Object
Pos
Namespace: Terminal.Gui
Assembly: Terminal.Gui.dll
Syntax
public class Pos
Remarks

Use the Pos objects on the X or Y properties of a view to control the position.

These can be used to set the absolute position, when merely assigning an integer value (via the implicit integer to Pos conversion), and they can be combined to produce more useful layouts, like: Pos.Center - 3, which would shift the postion of the view 3 characters to the left after centering for example.

Constructors

Pos()

Declaration
public Pos ();

Methods

AnchorEnd(Int32)

Creates a Pos object that is anchored to the end of the dimension, useful to flush the layout from the end.

Declaration
public static Terminal.Gui.Pos AnchorEnd (int margin = 0);
Parameters
Type Name Description
System.Int32 margin

Optional margin to set aside.

Returns
Type Description
Pos

The Pos object anchored to the end (the bottom or the right side).

Center()

Returns a Pos object that can be used to center the views.

Declaration
public static Terminal.Gui.Pos Center ();
Returns
Type Description
Pos

The center Pos.

Percent(Single)

Creates a percentage Pos object

Declaration
public static Terminal.Gui.Pos Percent (float n);
Parameters
Type Name Description
System.Single n

A value between 0 and 100 representing the percentage.

Returns
Type Description
Pos

The percent Pos object.

Operators

op_Addition(Pos, Pos)

Adds a Pos to a Pos, yielding a new Pos.

Declaration
public static Terminal.Gui.Pos op_Addition (Terminal.Gui.Pos left, Terminal.Gui.Pos right);
Parameters
Type Name Description
Pos left

The first Pos to add.

Pos right

The second Pos to add.

Returns
Type Description
Pos

The Pos that is the sum of the values of left and right.

op_Implicit(Int32 to Pos)

Creates an Absolute Pos from the specified integer value.

Declaration
public static Terminal.Gui.Pos op_Implicit (int n);
Parameters
Type Name Description
System.Int32 n

The value to convert to the pos.

Returns
Type Description
Pos

The Absolute Pos.

op_Subtraction(Pos, Pos)

Subtracts a Pos from a Pos, yielding a new Pos.

Declaration
public static Terminal.Gui.Pos op_Subtraction (Terminal.Gui.Pos left, Terminal.Gui.Pos right);
Parameters
Type Name Description
Pos left

The Pos to subtract from (the minuend).

Pos right

The Pos to subtract (the subtrahend).

Returns
Type Description
Pos

The Pos that is the left minus right.

Back to top Copyright © 2015-2017 Microsoft
Generated by DocFX