Point.Explicit Operador
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Sobrecargas
| Nombre | Description |
|---|---|
| Explicit(Point to Vector) |
Crea una Vector estructura con un X valor igual al valor del X punto y un Y valor igual al valor del Y punto. |
| Explicit(Point to Size) |
Crea una Size estructura con un Width valor igual a este punto X y un Height valor igual al valor de Y este punto. |
Explicit(Point to Vector)
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
Punto que se va a convertir.
Devoluciones
Vector con un X valor igual al valor del X punto y un Y valor igual al valor del Y punto.
Ejemplos
En el ejemplo siguiente se muestra cómo convertir explícitamente un objeto Point en .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
Se aplica a
Explicit(Point to Size)
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
Punto que se va a convertir.
Devoluciones
Estructura Size con un Width valor igual a este punto X y un Height valor igual al valor de Y este punto.
Ejemplos
En el ejemplo siguiente se muestra cómo convertir explícitamente un objeto Point en .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
Comentarios
Dado que una Size estructura no puede ser negativa, se usan los valores absolutos de X las propiedades y Y del punto.