Condividi tramite


Vector.Explicit Operatore

Definizione

Converte un vettore in Size o Point.

Overload

Explicit(Vector to Point)

Crea Point con i valori X e Y di questo vettore.

Explicit(Vector to Size)

Crea Size dagli offset di questo vettore.

Explicit(Vector to Point)

Crea Point con i valori X e Y di questo vettore.

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

Parametri

vector
Vector

Vettore da convertire.

Restituisce

Un punto con X- e Y uguali ai valori coordinati X e ai valori offset Y di vector.

Esempio

Nell'esempio seguente viene illustrato come convertire un Vector oggetto in un Pointoggetto .

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

Si applica a

Explicit(Vector to Size)

Crea Size dagli offset di questo vettore.

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

Parametri

vector
Vector

Vettore da convertire.

Restituisce

Size con Width uguale al valore assoluto della proprietà di questo vettore X e Height uguale al valore assoluto della proprietà di questo vettore Y.

Esempio

Nell'esempio seguente viene illustrato come convertire in modo esplicito un oggetto Vector in un Sizeoggetto .

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

Si applica a