Font.Equals(Object) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
指定したオブジェクトがFontであり、このFontFamilyと同じGdiVerticalFont、GdiCharSet、Style、Size、Unit、およびFontプロパティ値を持っているかどうかを示します。
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
テストするオブジェクト。
返品
true
obj パラメーターがFontであり、このFontFamilyと同じGdiVerticalFont、GdiCharSet、Style、Size、Unit、およびFontプロパティ値を持つ場合はfalse。
例
次のコード例は、Windows フォームで使用するように設計されており、PaintEventArgse が必要です。これは、Paint イベント ハンドラーのパラメーターです。 このコードでは、2 つの Font オブジェクトを作成し、それらが等しいかどうかをテストします。
public:
void Equals_Example( PaintEventArgs^ /*e*/ )
{
// Create a Font object.
System::Drawing::Font^ firstFont = gcnew System::Drawing::Font( "Arial",16 );
// Create a second Font object.
System::Drawing::Font^ secondFont = gcnew System::Drawing::Font( gcnew FontFamily( "Arial" ),16 );
// Test to see if firstFont is identical to secondFont.
bool fontTest = firstFont->Equals( secondFont );
// Display a message box with the result of the test.
MessageBox::Show( fontTest.ToString() );
}
public void Equals_Example(PaintEventArgs e)
{
// Create a Font object.
Font firstFont = new Font("Arial", 16);
// Create a second Font object.
Font secondFont = new Font(new FontFamily("Arial"), 16);
// Test to see if firstFont is identical to secondFont.
bool fontTest = firstFont.Equals(secondFont);
// Display a message box with the result of the test.
MessageBox.Show(fontTest.ToString());
}
Public Sub Equals_Example(ByVal e As PaintEventArgs)
' Create a Font object.
Dim firstFont As New Font("Arial", 16)
' Create a second Font object.
Dim secondFont As New Font(New FontFamily("Arial"), 16)
' Test to see if firstFont is identical to secondFont.
Dim fontTest As Boolean = firstFont.Equals(secondFont)
' Display a message box with the result of the test.
MessageBox.Show(fontTest.ToString())
End Sub