Font.Equals(Object) Methode
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Gibt an, ob das angegebene Objekt eine Font ist und über dieselben Eigenschaftswerte für FontFamily, GdiVerticalFont, GdiCharSet, Style, Size und Unit wie diese Font verfügt.
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 der obj
-Parameter eine Font ist und über dieselben Eigenschaftswerte für FontFamily, GdiVerticalFont, GdiCharSet, Style, Size und Unit wie diese Font verfügt, 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 erstellt zwei Font -Objekte und testet dann, ob sie gleichwertig sind.
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
Gilt für:
Feedback
https://aka.ms/ContentUserFeedback.
Bald verfügbar: Im Laufe des Jahres 2024 werden wir GitHub-Issues stufenweise als Feedbackmechanismus für Inhalte abbauen und durch ein neues Feedbacksystem ersetzen. Weitere Informationen finden Sie unterFeedback senden und anzeigen für