DrawingAttributes.Equality(DrawingAttributes, DrawingAttributes) 運算子
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
判斷指定 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 比較物件。
傳回
true若物件相等;否則,。 false
範例
以下範例比較兩個 DrawingAttributes 物件的相等性。 由於 Color和 StylusTip 上的 Height 、 Width、 attributes1和 attributes2 屬性都設定為相同的值,因此會出現「The DrawingAttributes are iqual」的訊息。
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若以下性質相等,則兩個物體相等:
Note
此 Equality 方法不會檢查自訂屬性的相等性。
此運算子 DrawingAttributes.Equals的等價方法是 。