Share via


Rect.Equals Yöntem

Tanım

İki dikdörtgenin eşit olup olmadığını gösterir.

Aşırı Yüklemeler

Equals(Rect, Rect)

Belirtilen dikdörtgenlerin eşit olup olmadığını gösterir.

Equals(Object)

Belirtilen nesnenin geçerli dikdörtgene eşit olup olmadığını gösterir.

Equals(Rect)

Belirtilen dikdörtgenin geçerli dikdörtgene eşit olup olmadığını gösterir.

Equals(Rect, Rect)

Belirtilen dikdörtgenlerin eşit olup olmadığını gösterir.

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

Parametreler

rect1
Rect

Karşılaştıracak ilk dikdörtgen.

rect2
Rect

Karşılaştıracak ikinci dikdörtgen.

Döndürülenler

true dikdörtgenler aynı Location ve Size değerlerine sahipse; değilse, false.

Örnekler

Aşağıdaki örnekte, bir dikdörtgenin Equals(Rect, Rect) başka bir dikdörtgene eşit olup olmadığını belirlemek için yönteminin nasıl kullanılacağı gösterilmektedir.

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;
}

Açıklamalar

Bu işlem nesne eşitliğini sınar.

Bu karşılaştırmada, iki örneği Double.NaN eşit olarak kabul edilir.

Not

Dikdörtgenin konumu ve boyutları değerlerle açıklanır Double . Double Değerler çalıştırıldığında duyarlığı kaybedebileceğinden, mantıksal olarak eşit olan iki değer arasındaki karşılaştırma başarısız olabilir.

Ayrıca bkz.

Şunlara uygulanır

Equals(Object)

Belirtilen nesnenin geçerli dikdörtgene eşit olup olmadığını gösterir.

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

Parametreler

o
Object

Geçerli dikdörtgenle karşılaştıracak nesne.

Döndürülenler

true ise oRect ve geçerli dikdörtgenle aynı Location ve Size değerlerine sahiptir; aksi takdirde , false.

Örnekler

Aşağıdaki örnekte, dikdörtgenin Equals(Object) belirtilen bir nesneye eşit olup olmadığını belirlemek için yönteminin nasıl kullanılacağı gösterilmektedir.

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;
}

Açıklamalar

Bu işlem nesne eşitliğini sınar.

Bu karşılaştırmada, iki örneği Double.NaN eşit olarak kabul edilir.

Not

Dikdörtgenin konumu ve boyutları değerlerle açıklanır Double . Double Değerler çalıştırıldığında duyarlığı kaybedebileceğinden, mantıksal olarak eşit olan iki değer arasındaki karşılaştırma başarısız olabilir.

Ayrıca bkz.

Şunlara uygulanır

Equals(Rect)

Belirtilen dikdörtgenin geçerli dikdörtgene eşit olup olmadığını gösterir.

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

Parametreler

value
Rect

Geçerli dikdörtgenle karşılaştıracak dikdörtgen.

Döndürülenler

true belirtilen dikdörtgen geçerli dikdörtgenle aynı Location ve Size değerlerine sahipse; değilse, false.

Örnekler

Aşağıdaki örnekte, bir dikdörtgenin Equals(Rect) belirtilen dikdörtgene eşit olup olmadığını belirlemek için yönteminin nasıl kullanılacağı gösterilmektedir.

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;
}

Açıklamalar

Bu işlem nesne eşitliğini sınar.

Bu karşılaştırmada, iki örneği Double.NaN eşit olarak kabul edilir.

Not

Dikdörtgenin konumu ve boyutları değerlerle açıklanır Double . Double Değerler çalıştırıldığında duyarlığı kaybedebileceğinden, mantıksal olarak eşit olan iki değer arasındaki karşılaştırma başarısız olabilir.

Ayrıca bkz.

Şunlara uygulanır