Point.Inequality(Point, Point) 運算子
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
比較兩種 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
第二個比較點。
傳回
true 若 point1 與 point2 有不同 X 或 Yfalse 座標;若 point1 與 point2 有相同的 X 和 Y 座標。
範例
以下範例展示了如何使用過載(!=)運算子檢查兩個 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 兩個邏輯相等的數值比較可能會失敗。