FontFamily.GetHashCode Metodo

Definizione

Ottiene un codice hash per l'oggetto FontFamily.

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

Restituisce

Codice hash per FontFamily.

Esempio

L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgse, che è un parametro del Paint gestore eventi. Il codice esegue le azioni seguenti:

  • Crea un oggetto FontFamily.

  • Ottiene il codice hash per la famiglia di caratteri.

  • Disegna il valore del codice hash sullo schermo come testo.

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

Si applica a