共用方式為


Vector(Double, Double) 建構函式

定義

初始化 Vector 結構的新執行個體。

public:
 Vector(double x, double y);
public Vector (double x, double y);
new System.Windows.Vector : double * double -> System.Windows.Vector
Public Sub New (x As Double, y As Double)

參數

x
Double

XVector 位移 (Offset)。

y
Double

YVector 位移 (Offset)。

範例

下列範例示範如何建立兩個向量,並將其加在一起。

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

適用於