FontFamily.GetHashCode 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取此 FontFamily的哈希代码。
public:
override int GetHashCode();
public override int GetHashCode ();
override this.GetHashCode : unit -> int
Public Overrides Function GetHashCode () As Integer
返回
此 FontFamily的哈希代码。
示例
下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse
,这是 Paint 事件处理程序的参数。 该代码执行以下操作:
创建 FontFamily。
获取字体系列的哈希代码。
将哈希代码的值作为文本绘制到屏幕。
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