DrawingAttributes.Equals(Object) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Détermine si l’objet spécifié DrawingAttributes est égal à l’objet actuel DrawingAttributes .
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
Paramètres
- o
- Object
Objet DrawingAttributes à comparer à l’objet actuel DrawingAttributes .
Retours
true si les objets sont égaux ; sinon, false.
Exemples
L’exemple suivant compare deux DrawingAttributes objets pour l’égalité. Étant donné que les ColorStylusTippropriétés , et HeightWidthles propriétés sur attributes1 et attributes2 sont définies sur les mêmes valeurs, le message « DrawingAttributes sont égaux » s’affiche.
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
Remarques
Deux DrawingAttributes objets sont égaux si les propriétés suivantes sont égales :
Note
La Equals méthode ne vérifie pas les propriétés personnalisées pour l’égalité.