Vector.Explicit Operator

Definition

Converts a vector into a Size or a Point.

Overloads

Explicit(Vector to Point)

Creates a Point with the X and Y values of this vector.

Explicit(Vector to Size)

Creates a Size from the offsets of this vector.

Explicit(Vector to Point)

Creates a Point with the X and Y values of this vector.

C#
public static explicit operator System.Windows.Point(System.Windows.Vector vector);

Parameters

vector
Vector

The vector to convert.

Returns

A point with X- and Y-coordinate values equal to the X and Y offset values of vector.

Examples

The following example shows how to convert a Vector into a Point.

C#
private Point overloadedExplicitOperatorExample2()
{
    Vector vector1 = new Vector(20, 30);

    // Explicitly converts a Vector structure into a Point structure.
    // returnPoint is equal to (20, 30).
    Point returnPoint = (Point)vector1;

    return returnPoint;
}

Applies to

.NET Framework 4.8.1 dan versi lain
Produk Versi
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

Explicit(Vector to Size)

Creates a Size from the offsets of this vector.

C#
public static explicit operator System.Windows.Size(System.Windows.Vector vector);

Parameters

vector
Vector

The vector to convert.

Returns

A Size with a Width equal to the absolute value of this vector's X property and a Height equal to the absolute value of this vector's Y property.

Examples

The following example shows how to explicitly convert a Vector into a Size.

C#
private Size overloadedExplicitOperatorExample1()
{
    Vector vector1 = new Vector(20, 30);

    // Explicitly converts a Vector structure into a Size structure.
    // returnSize has a width of 20 and a height of 30.
    Size returnSize = (Size)vector1;

    return returnSize;
}

Applies to

.NET Framework 4.8.1 dan versi lain
Produk Versi
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10