This documentation is archived and is not being maintained.

Point.op_Subtraction Method (Point, Point)

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

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

public static Vector operator - (
	Point point1,
	Point point2
)
You cannot use methods in XAML.

Parameters

point1

The point from which point2 is subtracted.

point2

The point to subtract from point1.

Return Value

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 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;

}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Show: