次の方法で共有


FontFamily.GetHashCode メソッド

この FontFamily オブジェクトのハッシュ コードを取得します。

Overrides Public Function GetHashCode() As Integer
[C#]
public override int GetHashCode();
[C++]
public: int GetHashCode();
[JScript]
public override function GetHashCode() : int;

戻り値

この FontFamily オブジェクトのハッシュ コード。

使用例

[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 Paint イベント ハンドラのパラメータである PaintEventArgs e が必要です。このコードは次のアクションを実行します。

  • FontFamily オブジェクトを作成します。
  • フォント ファミリのハッシュ コードを取得します。
  • ハッシュ コードの値をテキストで画面に描画します。
 
Public Sub GetHashCode_Example(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
        
[C#] 
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));
}
        

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

FontFamily クラス | FontFamily メンバ | System.Drawing 名前空間