FontFamily.Equals(Object) Methode

Definition

Gibt an, ob das angegebene Objekt ein FontFamily-Objekt und mit diesem FontFamily-Objekt identisch ist.

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

Parameter

obj
Object

Das zu überprüfende Objekt.

Gibt zurück

true, wenn obj eine FontFamily und identisch mit dieser FontFamily ist, andernfalls false.

Beispiele

Das folgende Codebeispiel ist für die Verwendung mit Windows Forms konzipiert und erfordert PaintEventArgse, was ein Parameter des Paint Ereignishandlers ist. Der Code führt die folgenden Aktionen aus:

  • Erstellt zwei Font Objekte.

  • Testet, ob sie gleichwertig sind.

  • Zeigt das Ergebnis des Tests in einem Meldungsfeld an.

public:
   void Equals_Example( PaintEventArgs^ /*e*/ )
   {
      // Create two FontFamily objects.
      FontFamily^ firstFontFamily = gcnew FontFamily( "Arial" );
      FontFamily^ secondFontFamily = gcnew FontFamily( "Times New Roman" );

      // Check to see if the two font families are equivalent.
      bool equalFonts = firstFontFamily->Equals( secondFontFamily );

      // Display the result of the test in a message box.
      MessageBox::Show( equalFonts.ToString() );
   }
public void Equals_Example(PaintEventArgs e)
{
    // Create two FontFamily objects.
    FontFamily firstFontFamily = new FontFamily("Arial");
    FontFamily secondFontFamily = new FontFamily("Times New Roman");
             
    // Check to see if the two font families are equivalent.
    bool equalFonts = firstFontFamily.Equals(secondFontFamily);
             
    // Display the result of the test in a message box.
    MessageBox.Show(equalFonts.ToString());
}
Public Sub Equals_Example(ByVal e As PaintEventArgs)

    ' Create two FontFamily objects.
    Dim firstFontFamily As New FontFamily("Arial")
    Dim secondFontFamily As New FontFamily("Times New Roman")

    ' Check to see if the two font families are equivalent.
    Dim equalFonts As Boolean = _
    firstFontFamily.Equals(secondFontFamily)

    ' Display the result of the test in a message box.
    MessageBox.Show(equalFonts.ToString())
End Sub

Gilt für: