语言

Point.Subtract 方法

定义

减去指定的 Point 或 Vector 从指定的 Point。

重载

名称 说明
Subtract(Point, Point)

从另一个指定值中减去指定的PointPoint值,并返回差值。Vector

Subtract(Point, Vector)

从指定的值中减去指定的VectorPoint值,并返回结果Point。

Subtract(Point, Point)

从另一个指定值中减去指定的PointPoint值,并返回差值。Vector

public:
 static System::Windows::Vector Subtract(System::Windows::Point point1, System::Windows::Point point2);
public static System.Windows.Vector Subtract(System.Windows.Point point1, System.Windows.Point point2);
static member Subtract : System.Windows.Point * System.Windows.Point -> System.Windows.Vector
Public Shared Function Subtract (point1 As Point, point2 As Point) As Vector

参数

point1
Point

从中减去的 point2 点。

point2
Point

要从 point1中减去的点。

返回

和 point1. 的point2区别。

示例

以下示例演示如何使用静态Point方法从另一个减去一个。PointSubtract

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;
}
Private Function subtractExample2() As Vector

    Dim point1 As New Point(10, 5)
    Dim point2 As 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)
    Dim vectorResult As Vector = Point.Subtract(point1, point2)

    Return vectorResult

End Function

另请参阅

适用于

Subtract(Point, Vector)

从指定的值中减去指定的VectorPoint值,并返回结果Point。

public:
 static System::Windows::Point Subtract(System::Windows::Point point, System::Windows::Vector vector);
public static System.Windows.Point Subtract(System.Windows.Point point, System.Windows.Vector vector);
static member Subtract : System.Windows.Point * System.Windows.Vector -> System.Windows.Point
Public Shared Function Subtract (point As Point, vector As Vector) As Point

参数

point
Point

从中减去的 vector 点。

vector
Vector

要 vector 减去 point的 。

返回

和 point. 的vector区别。

示例

以下示例演示如何从使用静态方法中减去 a VectorPoint。Subtract

       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;
       }
Private Function subtractExample1() As Point

    Dim point1 As New Point(10, 5)
    Dim vector1 As 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).
    Dim pointResult As Point = Point.Subtract(point1, vector1)

    Return pointResult

End Function

另请参阅

适用于