Class Dim
Dim properties of a
View to control the position.
Assembly: Terminal.Gui.dll
Syntax
Methods
|
Edit this page
View Source
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object other)
Parameters
| Type |
Name |
Description |
| object |
other |
The object to compare with the current object. |
Returns
| Type |
Description |
| bool |
true if the specified object is equal to the current object; otherwise, false. |
Overrides
|
Edit this page
View Source
Fill(int)
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 |
| int |
margin |
Margin to use. |
Returns
| Type |
Description |
| Dim |
The Fill dimension. |
|
Edit this page
View Source
Function(Func<int>)
Creates a "DimFunc" from the specified function.
Declaration
public static Dim Function(Func<int> function)
Parameters
| Type |
Name |
Description |
| Func<int> |
function |
The function to be executed. |
Returns
| Type |
Description |
| Dim |
The Dim returned from the function. |
|
Edit this page
View Source
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
| Type |
Description |
| int |
A hash code for the current object. |
Overrides
|
Edit this page
View Source
Height(View)
Returns a
Dim object tracks the Height of the specified
View.
Declaration
public static Dim Height(View view)
Parameters
| Type |
Name |
Description |
| View |
view |
The view that will be tracked. |
Returns
|
Edit this page
View Source
Percent(float, bool)
Creates a percentage
Dim object
Declaration
public static Dim Percent(float n, bool r = false)
Parameters
| Type |
Name |
Description |
| float |
n |
A value between 0 and 100 representing the percentage. |
| bool |
r |
If true the Percent is computed based on the remaining space after the X/Y anchor positions. If false is computed based on the whole original space. |
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),
};
|
Edit this page
View Source
Sized(int)
Creates an Absolute
Dim from the specified integer value.
Declaration
public static Dim Sized(int n)
Parameters
| Type |
Name |
Description |
| int |
n |
The value to convert to the Dim. |
Returns
| Type |
Description |
| Dim |
The Absolute Dim. |
|
Edit this page
View Source
Width(View)
Returns a
Dim object tracks the Width of the specified
View.
Declaration
public static Dim Width(View view)
Parameters
| Type |
Name |
Description |
| View |
view |
The view that will be tracked. |
Returns
Operators
|
Edit this page
View Source
operator +(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. |
|
Edit this page
View Source
implicit operator Dim(int)
Creates an Absolute
Dim from the specified integer value.
Declaration
public static implicit operator Dim(int n)
Parameters
| Type |
Name |
Description |
| int |
n |
The value to convert to the pos. |
Returns
| Type |
Description |
| Dim |
The Absolute Dim. |
|
Edit this page
View Source
operator -(Dim, Dim)
Subtracts a
Dim from a
Dim, yielding a new
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. |