Point.Explicit Operador
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í.
Explicit(Point to Vector) |
Crea una estructura Vector con un valor de X igual al valor de X del punto y con un valor de Y igual al valor de Y del punto. |
Explicit(Point to Size) |
Crea una estructura Size con un valor de Width igual al valor de X de este punto y con un valor de Height igual al valor de Y de este punto. |
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 valor de X igual al valor de X del punto y con un valor de Y igual al valor de Y del 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
.NET Framework 4.8.1 y otras versiones
Producto | Versiones |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
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 valor de Width igual al valor de X de este punto y con un valor de Height igual al valor de Y de 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 las propiedades y Y del X punto.
Se aplica a
.NET Framework 4.8.1 y otras versiones
Producto | Versiones |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
Comentarios de .NET
.NET es un proyecto de código abierto. Seleccione un vínculo para proporcionar comentarios: