FontFamily.ToString 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將此 FontFamily 轉換成人類可讀取的字串表示。
public:
override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String
傳回
表示這個 FontFamily的字串。
範例
下列程式代碼範例是專為搭配 Windows Forms 使用而設計,而且需要 PaintEventArgse
,這是 Paint 事件處理程式的參數。 程序代碼會建立 FontFamily,並將字型系列字串表示繪製到螢幕。
public:
void ToString_Example( PaintEventArgs^ e )
{
// Create a FontFamily object.
FontFamily^ myFontFamily = gcnew FontFamily( "Arial" );
// Draw a string representation of myFontFamily to the screen.
e->Graphics->DrawString( myFontFamily->ToString(), gcnew System::Drawing::Font( myFontFamily,16 ),
Brushes::Black, PointF(0,0) );
}
public void ToString_Example(PaintEventArgs e)
{
// Create a FontFamily object.
FontFamily myFontFamily = new FontFamily("Arial");
// Draw a string representation of myFontFamily to the screen.
e.Graphics.DrawString(
myFontFamily.ToString(),
new Font(myFontFamily, 16),
Brushes.Black,
new PointF(0, 0));
}
Public Sub ToString_Example(ByVal e As PaintEventArgs)
' Create a FontFamily object.
Dim myFontFamily As New FontFamily("Arial")
' Draw a string representation of myFontFamily to the screen.
e.Graphics.DrawString(myFontFamily.ToString(), _
New Font(myFontFamily, 16), Brushes.Black, New PointF(0, 0))
End Sub