Vector.Explicit 操作员
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
Explicit(Vector to Point) | |
Explicit(Vector to Size) |
根据此向量的偏移量创建 Size。 |
Explicit(Vector to Point)
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
参数
- vector
- Vector
要变换的向量。
返回
一个点,其 X 和 Y 坐标值与 vector
的 X 和 Y 偏移值相等。
示例
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
适用于
Explicit(Vector to Size)
根据此向量的偏移量创建 Size。
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
参数
- vector
- Vector
要变换的向量。
返回
一个 Size,其 Width 等于此向量的 X 属性的绝对值,其 Height 等于此向量的 Y 属性的绝对值。
示例
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