Font.GetHashCode メソッド

定義

この Font のハッシュ コードを取得します。

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

戻り値

この Font のハッシュ コード。

次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • Font を作成します。

  • そのフォントのハッシュ コードを取得します。

  • ハッシュ コードの値を含むメッセージ ボックスを表示します。

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

適用対象