Rect.Equals Metodo

Definizione

Indica se due rettangoli sono uguali.

Overload

Equals(Rect, Rect)

Indica se i rettangoli specificati sono uguali.

Equals(Object)

Indica se l’oggetto specificato è uguale al rettangolo corrente.

Equals(Rect)

Indica se il rettangolo specificato è uguale al rettangolo corrente.

Equals(Rect, Rect)

Indica se i rettangoli specificati sono uguali.

public:
 static bool Equals(System::Windows::Rect rect1, System::Windows::Rect rect2);
public static bool Equals (System.Windows.Rect rect1, System.Windows.Rect rect2);
static member Equals : System.Windows.Rect * System.Windows.Rect -> bool
Public Shared Function Equals (rect1 As Rect, rect2 As Rect) As Boolean

Parametri

rect1
Rect

Primo rettangolo da confrontare.

rect2
Rect

Secondo rettangolo da confrontare.

Restituisce

true se i rettangoli hanno gli stessi valori Location e Size; in caso contrario, false.

Esempio

Nell'esempio seguente viene illustrato come usare il Equals(Rect, Rect) metodo per determinare se un rettangolo è uguale a un altro.

private bool rectEqualsExample2()
{
    // Create a rectangle.
    Rect myRectangle1 = new Rect();

    // The Location property specifies the coordinates of the upper left-hand 
    // corner of the rectangle. 
    myRectangle1.Location = new Point(10, 5);

    // Set the Size property of the rectangle with a width of 200
    // and a height of 50.
    myRectangle1.Size = new Size(200, 50);

    // Create second rectangle to compare to the first.
    Rect myRectangle2 = new Rect();
    myRectangle2.Location = new Point(10, 5);
    myRectangle2.Size = new Size(200, 50);

    // Using the Equals method, see if the second rectangle is 
    // the same as the first rectangle. doesEqual is true because
    // both rectangles are exactly the same in that they both have the 
    // same location and size.
    bool doesEqual = Rect.Equals(myRectangle1, myRectangle2);

    return doesEqual;
}

Commenti

Questa operazione verifica l'uguaglianza degli oggetti.

In questo confronto, due istanze di Double.NaN sono considerate uguali.

Nota

La posizione e le dimensioni di un rettangolo sono descritte dai Double valori. Poiché Double i valori possono perdere precisione quando viene eseguita, un confronto tra due valori che sono logicamente uguali potrebbe non riuscire.

Vedi anche

Si applica a

Equals(Object)

Indica se l’oggetto specificato è uguale al rettangolo corrente.

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

Parametri

o
Object

Oggetto da confrontare con il rettangolo corrente.

Restituisce

true se o è un oggetto Rect e ha gli stessi valori Location e Size del rettangolo corrente; in caso contrario, false.

Esempio

Nell'esempio seguente viene illustrato come usare il Equals(Object) metodo per determinare se un rettangolo è uguale a un oggetto specificato.

private bool rectEqualsExample1()
{
    // Create a rectangle.
    Rect myRectangle1 = new Rect();

    // The Location property specifies the coordinates of the upper left-hand 
    // corner of the rectangle. 
    myRectangle1.Location = new Point(10, 5);

    // Set the Size property of the rectangle with a width of 200
    // and a height of 50.
    myRectangle1.Size = new Size(200, 50);

    // Create second rectangle to compare to the first.
    Rect myRectangle2 = new Rect();
    myRectangle2.Location = new Point(10, 5);
    myRectangle2.Size = new Size(200, 50);

    // Using the Equals method, see if the second rectangle is the
    // same as the first rectangle. doesEqual is true because both
    // rectangles are exactly the same with respect to location and size. 
    bool doesEqual = myRectangle1.Equals(myRectangle2);

    return doesEqual;
}

Commenti

Questa operazione verifica l'uguaglianza degli oggetti.

In questo confronto, due istanze di Double.NaN sono considerate uguali.

Nota

La posizione e le dimensioni di un rettangolo sono descritte dai Double valori. Poiché Double i valori possono perdere precisione quando viene eseguita, un confronto tra due valori che sono logicamente uguali potrebbe non riuscire.

Vedi anche

Si applica a

Equals(Rect)

Indica se il rettangolo specificato è uguale al rettangolo corrente.

public:
 bool Equals(System::Windows::Rect value);
public bool Equals (System.Windows.Rect value);
override this.Equals : System.Windows.Rect -> bool
Public Function Equals (value As Rect) As Boolean

Parametri

value
Rect

Rettangolo da confrontare con il rettangolo corrente.

Restituisce

true se il rettangolo specificato ha gli stessi valori Location e Size del rettangolo corrente; in caso contrario, false.

Esempio

Nell'esempio seguente viene illustrato come usare il Equals(Rect) metodo per determinare se un rettangolo è uguale a un rettangolo specificato.

private bool rectEqualsExample1()
{
    // Create a rectangle.
    Rect myRectangle1 = new Rect();

    // The Location property specifies the coordinates of the upper left-hand 
    // corner of the rectangle. 
    myRectangle1.Location = new Point(10, 5);

    // Set the Size property of the rectangle with a width of 200
    // and a height of 50.
    myRectangle1.Size = new Size(200, 50);

    // Create second rectangle to compare to the first.
    Rect myRectangle2 = new Rect();
    myRectangle2.Location = new Point(10, 5);
    myRectangle2.Size = new Size(200, 50);

    // Using the Equals method, see if the second rectangle is the
    // same as the first rectangle. doesEqual is true because both
    // rectangles are exactly the same with respect to location and size. 
    bool doesEqual = myRectangle1.Equals(myRectangle2);

    return doesEqual;
}

Commenti

Questa operazione verifica l'uguaglianza degli oggetti.

In questo confronto, due istanze di Double.NaN sono considerate uguali.

Nota

La posizione e le dimensioni di un rettangolo sono descritte dai Double valori. Poiché Double i valori possono perdere precisione quando viene eseguita, un confronto tra due valori che sono logicamente uguali potrebbe non riuscire.

Vedi anche

Si applica a