共用方式為


DrawingAttributes.Equality(DrawingAttributes, DrawingAttributes) 運算子

定義

判斷指定的 DrawingAttributes 物件是否相等。

public:
 static bool operator ==(System::Windows::Ink::DrawingAttributes ^ first, System::Windows::Ink::DrawingAttributes ^ second);
public static bool operator == (System.Windows.Ink.DrawingAttributes first, System.Windows.Ink.DrawingAttributes second);
static member ( = ) : System.Windows.Ink.DrawingAttributes * System.Windows.Ink.DrawingAttributes -> bool
Public Shared Operator == (first As DrawingAttributes, second As DrawingAttributes) As Boolean

參數

first
DrawingAttributes

要比較的第一個 DrawingAttributes 物件。

second
DrawingAttributes

要比較的第二個 DrawingAttributes 物件。

傳回

Boolean

如果物件相等則為 true,否則為 false

範例

下列範例會比較兩個 DrawingAttributes 物件是否相等。 由於 和 attributes2 上的 Color attributes1Height StylusTipWidth 屬性都設定為相同的值,因此會出現「DrawingAttributes 相等」訊息。

DrawingAttributes attributes1 = new DrawingAttributes();
attributes1.Color = Colors.Blue;
attributes1.StylusTip = StylusTip.Rectangle;
attributes1.Height = 5;
attributes1.Width = 5;

DrawingAttributes attributes2 = new DrawingAttributes();
attributes2.Color = Colors.Blue;
attributes2.StylusTip = StylusTip.Rectangle;
attributes2.Height = 5;
attributes2.Width = 5;
Dim attributes1 As New DrawingAttributes()
attributes1.Color = Colors.Blue
attributes1.StylusTip = StylusTip.Rectangle
attributes1.Height = 5
attributes1.Width = 5

Dim attributes2 As New DrawingAttributes()
attributes2.Color = Colors.Blue
attributes2.StylusTip = StylusTip.Rectangle
attributes2.Height = 5
attributes2.Width = 5
if (attributes1 == attributes2)
{
    MessageBox.Show("The DrawingAttributes are equal");
}
else
{
    MessageBox.Show("The DrawingAttributes are not equal");
}
If attributes1 = attributes2 Then
    MessageBox.Show("The DrawingAttributes are equal")
Else
    MessageBox.Show("The DrawingAttributes are not equal")
End If

備註

如果下列屬性相等,則兩 DrawingAttributes 個物件相等:

注意

方法 Equality 不會檢查自訂屬性是否相等。

這個運算子 DrawingAttributes.Equals 的對等方法是 。

適用於