共用方式為


Vector.Explicit 運算子

定義

將向量轉換為 SizePoint

多載

Explicit(Vector to Point)

使用這個向量的 PointX 值建立 Y

Explicit(Vector to Size)

從這個向量的位移建立 Size

Explicit(Vector to Point)

使用這個向量的 PointX 值建立 Y

public:
 static explicit operator System::Windows::Point(System::Windows::Vector vector);
public static explicit operator System.Windows.Point (System.Windows.Vector vector);
static member op_Explicit : System.Windows.Vector -> System.Windows.Point
Public Shared Narrowing Operator CType (vector As Vector) As Point

參數

vector
Vector

要轉換的向量。

傳回

Point

一點,其 XY 座標值等於 vectorXY 位移值。

範例

下列範例示範如何將 轉換成 Vector Point

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;
}
Private Function overloadedExplicitOperatorExample2() As Point
    Dim vector1 As New Vector(20, 30)

    ' Explicitly converts a Vector structure into a Point structure.
    ' returnPoint is equal to (20, 30).
    Dim returnPoint As Point = CType(vector1, Point)

    Return returnPoint

End Function

適用於

Explicit(Vector to Size)

從這個向量的位移建立 Size

public:
 static explicit operator System::Windows::Size(System::Windows::Vector vector);
public static explicit operator System.Windows.Size (System.Windows.Vector vector);
static member op_Explicit : System.Windows.Vector -> System.Windows.Size
Public Shared Narrowing Operator CType (vector As Vector) As Size

參數

vector
Vector

要轉換的向量。

傳回

Size

Size,其 Width 等於這個向量之 X 屬性的絕對值,而其 Height 等於這個向量之 Y 屬性的絕對值

範例

下列範例示範如何將 明確轉換成 Vector Size

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;
}
Private Function overloadedExplicitOperatorExample1() As Size
    Dim vector1 As New Vector(20, 30)

    ' Explicitly converts a Vector structure into a Size structure.
    ' returnSize has a width of 20 and a height of 30.
    Dim returnSize As Size = CType(vector1, Size)

    Return returnSize

End Function

適用於