Font.Equals(Object) Método
Definição
Indica se o objeto especificado é um Font e tem os mesmos valores de propriedade FontFamily, GdiVerticalFont, GdiCharSet, Style, Size e Unit que esse Font.Indicates whether the specified object is a Font and has the same FontFamily, GdiVerticalFont, GdiCharSet, Style, Size, and Unit property values as this 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
Parâmetros
- obj
- Object
O objeto a ser testado.The object to test.
Retornos
true se o parâmetro obj for um Font e tiver os mesmos valores de propriedade FontFamily, GdiVerticalFont, GdiCharSet, Style, Size e Unit que esse Font; caso contrário, false.true if the obj parameter is a Font and has the same FontFamily, GdiVerticalFont, GdiCharSet, Style, Size, and Unit property values as this Font; otherwise, false.
Exemplos
O exemplo de código a seguir foi projetado para uso com Windows Forms, e ele requer PaintEventArgs e , que é um parâmetro do Paint manipulador de eventos.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. O código cria dois Font objetos e, em seguida, testa se eles são equivalentes.The code creates two Font objects and then tests whether they are equivalent.
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