Share via


Font.GetHashCode Metode

Definisi

Mendapatkan kode hash untuk ini Font.

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

Mengembalikan

Kode hash untuk ini Font.

Contoh

Contoh kode berikut dirancang untuk digunakan dengan Formulir Windows, dan memerlukan PaintEventArgse, yang merupakan parameter penanganan Paint aktivitas. Kode melakukan tindakan berikut:

  • FontMembuat .

  • Mendapatkan kode hash untuk font tersebut.

  • Menampilkan kotak pesan dengan nilai kode hash.

public:
   void GetHashCode_Example( PaintEventArgs^ /*e*/ )
   {
      // Create a Font object.
      System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",16 );

      // Get the hash code for myFont.
      int hashCode = myFont->GetHashCode();

      // Display the hash code in a message box.
      MessageBox::Show( hashCode.ToString() );
   }
public void GetHashCode_Example(PaintEventArgs e)
{
             
    // Create a Font object.
    Font myFont = new Font("Arial", 16);
             
    // Get the hash code for myFont.
    int hashCode = myFont.GetHashCode();
             
    // Display the hash code in a message box.
    MessageBox.Show(hashCode.ToString());
}
Public Sub GetHashCode_Example(ByVal e As PaintEventArgs)

    ' Create a Font object.
    Dim myFont As New Font("Arial", 16)

    ' Get the hash code for myFont.
    Dim hashCode As Integer = myFont.GetHashCode()

    ' Display the hash code in a message box.
    MessageBox.Show(hashCode.ToString())
End Sub

Berlaku untuk