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.

It is possible to reference coordinates of another view by using the methods Left(View), Right(View), Bottom(View), Top(View). The X(View) and Y(View) are aliases to Left(View) and Top(View) respectively.

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).

At(Int32)

Creates an Absolute Pos from the specified integer value.

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

The value to convert to the pos.

Returns
Type Description
Pos

The Absolute Pos.

Bottom(View)

Returns a Pos object tracks the Bottom (Y+Height) coordinate of the specified view.

Declaration
public static Terminal.Gui.Pos Bottom (Terminal.Gui.View view);
Parameters
Type Name Description
View view

The view that will be tracked.

Returns
Type Description
Pos

The Position that depends on the other view.

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.

Left(View)

Returns a Pos object tracks the Left (X) position of the specified view.

Declaration
public static Terminal.Gui.Pos Left (Terminal.Gui.View view);
Parameters
Type Name Description
View view

The view that will be tracked.

Returns
Type Description
Pos

The Position that depends on the other view.

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.

Right(View)

Returns a Pos object tracks the Right (X+Width) coordinate of the specified view.

Declaration
public static Terminal.Gui.Pos Right (Terminal.Gui.View view);
Parameters
Type Name Description
View view

The view that will be tracked.

Returns
Type Description
Pos

The Position that depends on the other view.

Top(View)

Returns a Pos object tracks the Top (Y) position of the specified view.

Declaration
public static Terminal.Gui.Pos Top (Terminal.Gui.View view);
Parameters
Type Name Description
View view

The view that will be tracked.

Returns
Type Description
Pos

The Position that depends on the other view.

X(View)

Returns a Pos object tracks the Left (X) position of the specified view.

Declaration
public static Terminal.Gui.Pos X (Terminal.Gui.View view);
Parameters
Type Name Description
View view

The view that will be tracked.

Returns
Type Description
Pos

The Position that depends on the other view.

Y(View)

Returns a Pos object tracks the Top (Y) position of the specified view.

Declaration
public static Terminal.Gui.Pos Y (Terminal.Gui.View view);
Parameters
Type Name Description
View view

The view that will be tracked.

Returns
Type Description
Pos

The Position that depends on the other view.

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