Point.Inequality(Point, Point) Point.Inequality(Point, Point) Point.Inequality(Point, Point) Point.Inequality(Point, Point) Operator

定义

比较两个 Point 结构是否不相等。Compares two Point structures for inequality.

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 Point Point Point

要比较的第一个点。The first point to compare.

point2
Point Point Point Point

要比较的第二个点。The second point to compare.

返回

如果 point1point2 有不同的 XY 坐标,则为 true;如果 point1point2 有相同的 XY 坐标,则为.falsetrue if point1 and point2 have different X or Y coordinates; false if point1 and point2 have the same X and Y coordinates.

示例

下面的示例演示如何使用重载 (! Point =) 运算符检查两个结构是否不相等。The following example shows how to check whether two Point structures are not equal, using the overloaded (!=) operator.

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

注解

使用Y XDouble描述点的和坐标。A point's X and Y coordinates are described using Double values. 由于Double值在操作时可能会丢失精度, 因此, 逻辑Point上相等的两个值之间的比较可能会失败。Because Double values can lose precision when operated on, a comparison between two Point values that are logically equal might fail.

适用于