PointF.Equality(PointF, PointF) 演算子

定義

2 つの PointF 構造体を比較します。Compares two PointF structures. この結果は、2 つの X 構造体の Y プロパティと PointF プロパティの値が等しいかどうかを示します。The result specifies whether the values of the X and Y properties of the two PointF structures are equal.

public:
 static bool operator ==(System::Drawing::PointF left, System::Drawing::PointF right);
public static bool operator == (System.Drawing.PointF left, System.Drawing.PointF right);
static member ( = ) : System.Drawing.PointF * System.Drawing.PointF -> bool
Public Shared Operator == (left As PointF, right As PointF) As Boolean

パラメーター

left
PointF

比較する PointFA PointF to compare.

right
PointF

比較する PointFA PointF to compare.

戻り値

Boolean

左と右の X 構造体の Y 値と PointF 値が等しい場合は true を返します。それ以外の場合は false を返します。true if the X and Y values of the left and right PointF structures are equal; otherwise, false.

演算子を使用する方法を次のコード例に示し Equality ます。The following code example demonstrates how to use the Equality operator. この例を実行するには、Windows フォームに次のコードを貼り付けます。To run this example, paste the following code into a Windows Form. フォームの Paint イベントを処理し opAdditionExample 、を e として渡し PaintEventArgs ます。Handle the form's Paint event and call opAdditionExample, passing e as PaintEventArgs.

private void OpAdditionExample(PaintEventArgs e)
{
    PointF point1 = new PointF(120.5F, 120F);
    SizeF size1 = new SizeF(120.5F, 30.5F);
    RectangleF rect1 = new RectangleF(point1, size1);
    if (new PointF(rect1.Right, rect1.Bottom) == point1 + size1)
        e.Graphics.DrawString("They are equal", this.Font, Brushes.Black, rect1);
    else
        e.Graphics.DrawString("They are not equal", this.Font, Brushes.Red, rect1);
}
Private Sub OpAdditionExample(ByVal e As PaintEventArgs) 
    Dim size1 As New SizeF(120.5F, 30.5F)
    Dim point1 As New PointF(20.5F, 20F)
    Dim rect1 As New RectangleF(point1, size1)
    If New PointF(rect1.Right, rect1.Bottom) = point1 + size1 Then
        e.Graphics.DrawString("They are equal", Me.Font, Brushes.Black, rect1)
    Else
        e.Graphics.DrawString("They are not equal", Me.Font, Brushes.Red, rect1)
    End If
 
End Sub

適用対象