Point.Explicit Operador

Definição

Converte um Point em um Size ou Vector.Converts a Point into a Size or a Vector.

Sobrecargas

Explicit(Point to Vector)

Cria uma estrutura Vector com um valor X igual ao valor X do ponto e um valor Y igual ao valor Y do ponto.Creates a Vector structure with an X value equal to the point's X value and a Y value equal to the point's Y value.

Explicit(Point to Size)

Cria uma estrutura Size com um Width igual ao valor X desse ponto e um Height igual ao valor Y desse ponto.Creates a Size structure with a Width equal to this point's X value and a Height equal to this point's Y value.

Explicit(Point to Vector)

Cria uma estrutura Vector com um valor X igual ao valor X do ponto e um valor Y igual ao valor Y do ponto.Creates a Vector structure with an X value equal to the point's X value and a Y value equal to the point's Y value.

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

Parâmetros

point
Point

O ponto para converter.The point to convert.

Retornos

Um vetor com um valor X igual ao valor X do ponto e um valor Y igual ao valor Y do ponto.A vector with an X value equal to the point's X value and a Y value equal to the point's Y value.

Exemplos

O exemplo a seguir mostra como converter explicitamente um Point em um Vector.The following example shows how to explicitly convert a Point into a 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

Explicit(Point to Size)

Cria uma estrutura Size com um Width igual ao valor X desse ponto e um Height igual ao valor Y desse ponto.Creates a Size structure with a Width equal to this point's X value and a Height equal to this point's Y value.

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

Parâmetros

point
Point

O ponto para converter.The point to convert.

Retornos

Um Size estrutura com um Width igual ao valor X desse ponto e um Height igual ao valor Y desse ponto.A Size structure with a Width equal to this point's X value and a Height equal to this point's Y value.

Exemplos

O exemplo a seguir mostra como converter explicitamente um Point em um Size.The following example shows how to explicitly convert a Point into a 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

Comentários

Como uma Size estrutura não pode ser negativa, os valores absolutos das propriedades X e Y do ponto são usados.Because a Size structure cannot be negative, the absolute values of the point's X and Y properties are used.

Aplica-se a