อ่านในภาษาอังกฤษ แก้ไข

แชร์ผ่าน


Point.Subtract Method

Definition

Subtracts the specified Point or Vector from the specified Point.

Overloads

Subtract(Point, Point)

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

Subtract(Point, Vector)

Subtracts the specified Vector from the specified Point and returns the resulting Point.

Subtract(Point, Point)

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

C#
public static System.Windows.Vector Subtract(System.Windows.Point point1, System.Windows.Point point2);

Parameters

point1
Point

The point from which point2 is subtracted.

point2
Point

The point to subtract from point1.

Returns

The difference between point1 and point2.

Examples

The following example shows how to subtract a Point from another Point using the static Subtract method.

C#
private Vector subtractExample2()
{

    Point point1 = new Point(10, 5);
    Point point2 = new Point(15, 40);

    // Subtracts a Point from a Point using the static Subtract method
    // and returns the difference as a Vector.
    // vectorResult is equal to (-5, -35)
    Vector vectorResult = Point.Subtract(point1, point2);

    return vectorResult;
}

See also

Applies to

.NET Framework 4.8.1 และรุ่นอื่นๆ
ผลิตภัณฑ์ เวอร์ชัน
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

Subtract(Point, Vector)

Subtracts the specified Vector from the specified Point and returns the resulting Point.

C#
public static System.Windows.Point Subtract(System.Windows.Point point, System.Windows.Vector vector);

Parameters

point
Point

The point from which vector is subtracted.

vector
Vector

The vector to subtract from point.

Returns

The difference between point and vector.

Examples

The following example shows how to subtract a Vector from a Point using the static Subtract method.

C#
       private Point subtractExample1()
       {

           Point point1 = new Point(10, 5);
           Vector vector1 = new Vector(20, 30);

           // Subtracts a Vector from a Point using the static Subtract method
           // and returns the difference as a Point.
           // pointResult is equal to (-10, -25).
           Point pointResult = Point.Subtract(point1, vector1);

           return pointResult;
       }

See also

Applies to

.NET Framework 4.8.1 และรุ่นอื่นๆ
ผลิตภัณฑ์ เวอร์ชัน
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10