DrawingAttributes.Equals(Object) Methode

Definition

Bestimmt, ob das angegebene DrawingAttributes Objekt dem aktuellen DrawingAttributes Objekt entspricht.

public:
 override bool Equals(System::Object ^ o);
public override bool Equals(object o);
override this.Equals : obj -> bool
Public Overrides Function Equals (o As Object) As Boolean

Parameter

o
Object

Das DrawingAttributes Objekt, das mit dem aktuellen DrawingAttributes Objekt verglichen werden soll.

Gibt zurück

truewenn die Objekte gleich sind; andernfalls . false

Beispiele

Im folgenden Beispiel werden zwei DrawingAttributes Objekte für die Gleichheit verglichen. Da die ColorEigenschaften StylusTipHeightund Width Eigenschaften auf attributes1attributes2 dieselben Werte festgelegt sind, wird die Meldung "DrawingAttributes sind gleich" angezeigt.

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.Equals(attributes2))
{
    MessageBox.Show("The DrawingAttributes are equal");
}
else
{
    MessageBox.Show("The DrawingAttributes are not equal");
}
If attributes1.Equals(attributes2) Then
    MessageBox.Show("The DrawingAttributes are equal")
Else
    MessageBox.Show("The DrawingAttributes are not equal")
End If

Hinweise

Zwei DrawingAttributes Objekte sind gleich, wenn die folgenden Eigenschaften gleich sind:

Note

Die Equals Methode überprüft nicht die benutzerdefinierten Eigenschaften auf Gleichheit.

Gilt für:

Weitere Informationen