Class Dim
Dim properties of a View to control the position.
Inheritance
System.Object
Dim
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Terminal.Gui
Assembly: Terminal.Gui.dll
Syntax
public class Dim
Remarks
Use the Dim objects on the Width or Height 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.
Methods
Fill(Int32)
Initializes a new instance of the Dim class that fills the dimension, but leaves the specified number of colums for a margin.
Declaration
public static Dim Fill(int margin = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | margin | Margin to use. |
Returns
Type | Description |
---|---|
Dim | The Fill dimension. |
Height(View)
Declaration
public static Dim Height(View view)
Parameters
Type | Name | Description |
---|---|---|
View | view | The view that will be tracked. |
Returns
Type | Description |
---|---|
Dim | The Dim of the other View. |
Percent(Single)
Creates a percentage Dim object
Declaration
public static Dim Percent(float n)
Parameters
Type | Name | Description |
---|---|---|
System.Single | n | A value between 0 and 100 representing the percentage. |
Returns
Type | Description |
---|---|
Dim | The percent Dim object. |
Examples
This initializes a TextFieldthat is centered horizontally, is 50% of the way down, is 30% the height, and is 80% the width of the View it added to.var textView = new TextView () {
X = Pos.Center (),
Y = Pos.Percent (50),
Width = Dim.Percent (80),
Height = Dim.Percent (30),
};
Sized(Int32)
Creates an Absolute Dim from the specified integer value.
Declaration
public static Dim Sized(int n)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | n | The value to convert to the Dim. |
Returns
Type | Description |
---|---|
Dim | The Absolute Dim. |
Width(View)
Declaration
public static Dim Width(View view)
Parameters
Type | Name | Description |
---|---|---|
View | view | The view that will be tracked. |
Returns
Type | Description |
---|---|
Dim | The Dim of the other View. |
Operators
Addition(Dim, Dim)
Declaration
public static Dim operator +(Dim left, Dim right)
Parameters
Type | Name | Description |
---|---|---|
Dim | left | The first Dim to add. |
Dim | right | The second Dim to add. |
Returns
Type | Description |
---|---|
Dim | The Dim that is the sum of the values of left and right . |
Implicit(Int32 to Dim)
Creates an Absolute Dim from the specified integer value.
Declaration
public static implicit operator Dim(int n)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | n | The value to convert to the pos. |
Returns
Type | Description |
---|---|
Dim | The Absolute Dim. |
Subtraction(Dim, Dim)
Declaration
public static Dim operator -(Dim left, Dim right)
Parameters
Type | Name | Description |
---|---|---|
Dim | left | The Dim to subtract from (the minuend). |
Dim | right | The Dim to subtract (the subtrahend). |
Returns
Type | Description |
---|---|
Dim | The Dim that is the left minus right . |