Vector.Explicit Operador

Definição

Converte um vetor em um Size ou em um Point.

Sobrecargas

Explicit(Vector to Point)

Cria um Point com os valores X e Y desse vetor.

Explicit(Vector to Size)

Cria um Size usando os deslocamentos desse vetor.

Explicit(Vector to Point)

Cria um Point com os valores X e Y desse vetor.

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

Parâmetros

vector
Vector

O vetor a ser convertido.

Retornos

Um ponto com os valores de coordenada X e Y iguais aos valores X e Y de deslocamento do vector.

Exemplos

O exemplo a seguir mostra como converter um Vector em um 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

Aplica-se a

Explicit(Vector to Size)

Cria um Size usando os deslocamentos desse vetor.

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

Parâmetros

vector
Vector

O vetor a ser convertido.

Retornos

Um Size com uma Width igual ao valor absoluto da propriedade X desse vetor e uma Height igual ao valor absoluto da propriedade Y desse vetor.

Exemplos

O exemplo a seguir mostra como converter explicitamente um Vector em um 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

Aplica-se a