Vector.Add 方法

定义

将向量添加到点或其他向量。

重载

Add(Vector, Point)

按指定向量平移指定点,并返回结果点。

Add(Vector, Vector)

将两个向量相加并将结果以 Vector 结构的形式返回。

Add(Vector, Point)

按指定向量平移指定点,并返回结果点。

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

参数

vector
Vector

指定点的平移量。

point
Point

要平移的点。

返回

Point

point 平移 vector 的结果。

示例

以下示例演示如何使用此方法向结构添加 Point 结构 Vector

private Point addPointAndVectorExample()
{
    Vector vector1 = new Vector(20, 30);
    Point point1 = new Point(10, 5);
    Point pointResult = new Point();

    // Add Point and Vector together.
    // pointResult is equal to (30,35).
    pointResult = Vector.Add(vector1, point1);

    return pointResult;
}

另请参阅

适用于

Add(Vector, Vector)

将两个向量相加并将结果以 Vector 结构的形式返回。

public:
 static System::Windows::Vector Add(System::Windows::Vector vector1, System::Windows::Vector vector2);
public static System.Windows.Vector Add (System.Windows.Vector vector1, System.Windows.Vector vector2);
static member Add : System.Windows.Vector * System.Windows.Vector -> System.Windows.Vector
Public Shared Function Add (vector1 As Vector, vector2 As Vector) As Vector

参数

vector1
Vector

要相加的第一个向量。

vector2
Vector

要相加的第二个向量。

返回

Vector

vector1vector2 的和。

示例

以下示例演示如何使用此方法添加两 Vector 个结构。

private Vector addTwoVectorsExample()
{
    // Create two Vector structures.
    Vector vector1 = new Vector(20, 30);
    Vector vector2 = new Vector(45, 70);
    Vector vectorResult = new Vector();

    // Add the vectors together. 
    // vectorResult is equal to (65, 100).
    vectorResult = Vector.Add(vector1, vector2);

    return vectorResult;
}

另请参阅

适用于