Point.Inequality(Point, Point) 運算子

定義

比較兩種 Point 不平等結構。

public:
 static bool operator !=(System::Windows::Point point1, System::Windows::Point point2);
public static bool operator !=(System.Windows.Point point1, System.Windows.Point point2);
static member op_Inequality : System.Windows.Point * System.Windows.Point -> bool
Public Shared Operator != (point1 As Point, point2 As Point) As Boolean

參數

point1
Point

第一個比較點。

point2
Point

第二個比較點。

傳回

truepoint1point2 有不同 XYfalse 座標;若 point1point2 有相同的 XY 座標。

範例

以下範例展示了如何使用過載(!=)運算子檢查兩個 Point 結構是否不相等。

private Boolean overloadedInequalityOperatorExample()
{
    Point point1 = new Point(20, 30);
    Point point2 = new Point(45, 70);

    // Check whether the two Points are not equal, using the overloaded 
    // inequality operator.
    // areNotEqual is True.
    Boolean areNotEqual = (point1 != point2);

    return areNotEqual;
}
Private Function overloadedInequalityOperatorExample() As Boolean
    Dim point1 As New Point(20, 30)
    Dim point2 As New Point(45, 70)

    ' Check whether the two Points are not equal, using the overloaded 
    ' inequality operator.
    ' areNotEqual is True.
    Dim areNotEqual As Boolean = (point1 <> point2)

    Return areNotEqual

End Function

備註

X點與Y座標皆以Double數值描述。 由於 Double 數值在操作時可能失去精確度, Point 兩個邏輯相等的數值比較可能會失敗。

適用於