Point.Subtraction Operator (Point, Point)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Subtracts the specified Point from another specified Point and returns the difference as a Vector.

Namespace:   System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)

Public Shared Operator - (
	point1 As Point,
	point2 As Point
) As Vector


Type: System.Windows.Point

The point from which point2 is subtracted.

Type: System.Windows.Point

The point to subtract from point1.

Return Value

Type: System.Windows.Vector

The difference between point1 and point2.

The following example shows how to subtract a Point from another Point and return a Vector using the overloaded (-) operator.

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

.NET Framework
Available since 3.0
Return to top