FontFamily.GetHashCode 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.
Ruft einen Hashcode für diese FontFamilyab.
public:
override int GetHashCode();
public override int GetHashCode ();
override this.GetHashCode : unit -> int
Public Overrides Function GetHashCode () As Integer
Gibt zurück
Der Hashcode für diese FontFamily.
Beispiele
Das folgende Codebeispiel wurde für die Verwendung mit Windows Forms entwickelt und erfordert PaintEventArgse
, bei dem es sich um einen Parameter des Paint-Ereignishandlers handelt. Der Code führt die folgenden Aktionen aus:
Erstellt eine FontFamily.
Ruft den Hashcode für die Schriftartfamilie ab.
Zeichnet den Wert des Hashcodes als Text auf den Bildschirm.
public:
void GetHashCode_Example( PaintEventArgs^ e )
{
// Create a FontFamily object.
FontFamily^ myFontFamily = gcnew FontFamily( "Arial" );
// Get the hash code for myFontFamily.
int hashCode = myFontFamily->GetHashCode();
// Draw the value of hashCode to the screen as a string.
e->Graphics->DrawString( String::Format( "hashCode = {0}", hashCode ),
gcnew System::Drawing::Font( myFontFamily,16 ), Brushes::Black, PointF(0,0) );
}
public void GetHashCode_Example(PaintEventArgs e)
{
// Create a FontFamily object.
FontFamily myFontFamily = new FontFamily("Arial");
// Get the hash code for myFontFamily.
int hashCode = myFontFamily.GetHashCode();
// Draw the value of hashCode to the screen as a string.
e.Graphics.DrawString(
"hashCode = " + hashCode.ToString(),
new Font(myFontFamily, 16),
Brushes.Black,
new PointF(0, 0));
}
Public Sub GetHashCode_Example(ByVal e As PaintEventArgs)
' Create a FontFamily object.
Dim myFontFamily As New FontFamily("Arial")
' Get the hash code for myFontFamily.
Dim hashCode As Integer = myFontFamily.GetHashCode()
' Draw the value of hashCode to the screen as a string.
e.Graphics.DrawString("hashCode = " & hashCode.ToString(), _
New Font(myFontFamily, 16), Brushes.Black, New PointF(0, 0))
End Sub
Gilt für:
Feedback
https://aka.ms/ContentUserFeedback.
Bald verfügbar: Im Laufe des Jahres 2024 werden wir GitHub-Tickets als Feedbackmechanismus für Inhalte auslaufen lassen und es durch ein neues Feedbacksystem ersetzen. Weitere Informationen finden Sie unter:Einreichen und Feedback anzeigen für