FontFamily.Equals(Object) Metoda

Definice

Určuje, zda zadaný objekt je FontFamily a je shodný s tímto FontFamilyobjektem .

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

Parametry

obj
Object

Objekt, který se má ověřit

Návraty

true pokud obj je a FontFamily je shodný s tímto FontFamily; v opačném případě false.

Příklady

Následující příklad kódu je určen pro použití s model Windows Forms a vyžaduje PaintEventArgse, což je parametr obslužné rutiny Paint události. Kód provede následující akce:

  • Vytvoří dva Font objekty.

  • Testuje, jestli jsou ekvivalentní.

  • Zobrazí výsledek testu v okně se zprávou.

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

Platí pro