Font.GetHashCode Font.GetHashCode Font.GetHashCode Font.GetHashCode Method

定義

取得這個 Font 的雜湊碼。Gets the hash code for this Font.

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

傳回

這個 Font 的雜湊程式碼。The hash code for this Font.

範例

下列程式碼範例是針對與 Windows Forms 搭配使用所設計, 而且PaintEventArgs它需要e, 這Paint是事件處理常式的參數。The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. 該程式碼執行下列動作:The code performs the following actions:

  • 建立 FontCreates a Font.

  • 取得該字型的雜湊碼。Gets the hash code for that font.

  • 顯示訊息方塊, 其中包含雜湊碼的值。Displays a message box with the value of the hash code.

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

適用於