FontFamily.GetHashCode Metoda

Definicja

Pobiera kod skrótu dla tego elementu FontFamily .Gets a hash code for this FontFamily.

public:
 override int GetHashCode();
public override int GetHashCode ();
override this.GetHashCode : unit -> int
Public Overrides Function GetHashCode () As Integer

Zwraca

Int32

Kod skrótu dla tego elementu FontFamily .The hash code for this FontFamily.

Przykłady

Poniższy przykład kodu jest przeznaczony do użytku z Windows Forms i wymaga PaintEventArgs e , który jest parametrem Paint programu obsługi zdarzeń.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. Kod wykonuje następujące czynności:The code performs the following actions:

  • Tworzy FontFamily .Creates a FontFamily.

  • Pobiera kod skrótu rodziny czcionek.Gets the hash code for the font family.

  • Rysuje wartość kodu skrótu do ekranu jako tekst.Draws the value of the hash code to the screen as text.

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

Dotyczy