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