Point.Subtraction 運算子
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
Subtraction(Point, Point) | |
Subtraction(Point, Vector) |
Subtraction(Point, Point)
public:
static System::Windows::Vector operator -(System::Windows::Point point1, System::Windows::Point point2);
public static System.Windows.Vector operator - (System.Windows.Point point1, System.Windows.Point point2);
static member ( - ) : System.Windows.Point * System.Windows.Point -> System.Windows.Vector
Public Shared Operator - (point1 As Point, point2 As Point) As Vector
參數
- point1
- Point
減去 point2
的點。
- point2
- Point
要從 point1
減去的點。
傳回
point1
與 point2
之間的差數。
範例
下列範例示範如何從另一 Point 個 Point 減去 ,並使用多載的 (-) 運算子傳回 Vector 。
private Vector overloadedSubtractionOperatorExample2()
{
Point point1 = new Point(10, 5);
Point point2 = new Point(15, 40);
// Subtracts a Point from another Point using the overloaded subtraction (-)
// operator and returns the difference as a Vector.
// vectorResult is equal to (-5, -35).
Vector vectorResult = point1 - point2;
return vectorResult;
}
Private Function overloadedSubtractionOperatorExample2() As Vector
Dim point1 As New Point(10, 5)
Dim point2 As New Point(15, 40)
' Subtracts a Point from another Point using the overloaded subtraction (-)
' operator and returns the difference as a Vector.
' vectorResult is equal to (-5, -35).
Dim vectorResult As Vector = point1 - point2
Return vectorResult
End Function
另請參閱
適用於
Subtraction(Point, Vector)
public:
static System::Windows::Point operator -(System::Windows::Point point, System::Windows::Vector vector);
public static System.Windows.Point operator - (System.Windows.Point point, System.Windows.Vector vector);
static member ( - ) : System.Windows.Point * System.Windows.Vector -> System.Windows.Point
Public Shared Operator - (point As Point, vector As Vector) As Point
參數
- point
- Point
減去 vector
的點。
- vector
- Vector
要從 point1
減去的向量。
傳回
point
與 vector
之間的差數。
範例
下列範例示範如何使用多載的 (-) 運算子從 Point 減去 Vector 。
private Point overloadedSubtractionOperatorExample1()
{
Point point1 = new Point(10, 5);
Vector vector1 = new Vector(20, 30);
// Subtracts a Vector from a Point using the overloaded subtraction (-) operator.
// pointResult is equal to (-10, -25)
Point pointResult = point1 - vector1;
return pointResult;
}
Private Function overloadedSubtractionOperatorExample1() As Point
Dim point1 As New Point(10, 5)
Dim vector1 As New Vector(20, 30)
' Subtracts a Vector from a Point using the overloaded subtraction (-) operator.
' pointResult is equal to (-10, -25)
Dim pointResult As Point = point1 - vector1
Return pointResult
End Function