Point.Explicit Operador

Definição

Converte a Point em a Size ou em Vector.

Sobrecargas

Name Descrição
Explicit(Point to Vector)

Cria uma Vector estrutura com um X valor igual ao valor do X ponto e um Y valor igual ao valor do Y ponto.

Explicit(Point to Size)

Cria uma Size estrutura com um Width igual ao X valor deste ponto e um Height igual ao valor deste Y ponto.

Explicit(Point to Vector)

Cria uma Vector estrutura com um X valor igual ao valor do X ponto e um Y valor igual ao valor do Y ponto.

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

Parâmetros

point
Point

O ponto para converter.

Devoluções

Um vetor com X um valor igual ao valor do X ponto e Y um valor igual ao valor do Y ponto.

Exemplos

O exemplo seguinte mostra como converter explicitamente um Point para um Vector.

private Vector overloadedExplicitOperatorVectorExample()
{

    Point point1 = new Point(10, 5);

    // Explicitly converts a Point structure into a Vector structure.
    // returnVector is equal to (10,5).
    Vector returnVector = (Vector)point1;

    return returnVector;
}
Private Function overloadedExplicitOperatorVectorExample() As Vector

    Dim point1 As New Point(10, 5)

    ' Explicitly converts a Point structure into a Vector structure.
    ' returnVector is equal to (10,5).
    Dim returnVector As Vector = CType(point1, Vector)

    Return returnVector

End Function

Aplica-se a

Explicit(Point to Size)

Cria uma Size estrutura com um Width igual ao X valor deste ponto e um Height igual ao valor deste Y ponto.

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

Parâmetros

point
Point

O ponto para converter.

Devoluções

Uma Size estrutura com a Width igual ao valor deste X ponto e a Height igual ao valor deste Y ponto.

Exemplos

O exemplo seguinte mostra como converter explicitamente um Point para um Size.

private Size overloadedExplicitOperatorSizeExample()
{

    Point point1 = new Point(10, 5);

    // Explicitly converts a Point structure into a Size structure.
    // returnSize has a width of 10 and a height of 5  
    Size returnSize = (Size)point1;

    return returnSize;
}
Private Function overloadedExplicitOperatorSizeExample() As Size

    Dim point1 As New Point(10, 5)

    ' Explicitly converts a Point structure into a Size structure.
    ' returnSize has a width of 10 and a height of 5  
    Dim returnSize As Size = CType(point1, Size)

    Return returnSize

End Function

Observações

Como uma Size estrutura não pode ser negativa, utilizam-se os valores absolutos dos pontos X e Y das propriedades.

Aplica-se a