PointF.Equality(PointF, PointF) 運算子
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
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
參數
傳回
如果左側和右側 X 結構的 Y 和 PointF 值相等,則為 true
,否則為 false
。
範例
下列程式代碼範例示範如何使用 Equality 運算元。 若要執行此範例,請將下列程式代碼貼到 Windows Form 中。 處理表單的事件 Paint 並呼叫 opAdditionExample
,並傳遞 e
為 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