FontFamily.Equals(Object) メソッド

定義

指定したオブジェクトが FontFamily であるかどうか、またこの FontFamily と同一であるかどうかを示します。

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

パラメーター

obj
Object

テストするオブジェクト。

戻り値

objFontFamily であり、この FontFamily と同一である場合は true。それ以外の場合は false

次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • 2 つの Font オブジェクトを作成します。

  • それらが同等であるかどうかをテストします。

  • テストの結果をメッセージ ボックスに表示します。

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

適用対象