FontFamily.IsStyleAvailable メソッド
指定した FontStyle 列挙体が使用可能かどうかを示します。
Public Function IsStyleAvailable( _
ByVal style As FontStyle _) As Boolean
[C#]
public bool IsStyleAvailable(FontStylestyle);
[C++]
public: bool IsStyleAvailable(FontStylestyle);
[JScript]
public function IsStyleAvailable(
style : FontStyle) : Boolean;
パラメータ
- style
テストする FontStyle 列挙体。
戻り値
指定した FontStyle が使用可能な場合、このメソッドは true を返します。それ以外の場合は false を返します。
使用例
[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 Paint イベント ハンドラのパラメータである PaintEventArgs e が必要です。このコードは次のアクションを実行します。
- FontFamily オブジェクトを作成します。
- フォント ファミリが斜体フォントで使用可能かどうかをテストします。
- 使用可能な場合は、テキストを画面に描画します。
Public Sub IsStyleAvailable_Example(e As PaintEventArgs)
' Create a FontFamily object.
Dim myFontFamily As New FontFamily("Arial")
' Test whether myFontFamily is available in Italic.
If myFontFamily.IsStyleAvailable(FontStyle.Italic) Then
' Create a Font object using myFontFamily.
Dim familyFont As New Font(myFontFamily, 16, FontStyle.Italic)
' Use familyFont to draw text to the screen.
e.Graphics.DrawString(myFontFamily.Name & _
" is available in Italic", familyFont, Brushes.Black, _
New PointF(0, 0))
End If
End Sub
[C#]
public void IsStyleAvailable_Example(PaintEventArgs e)
{
// Create a FontFamily object.
FontFamily myFontFamily = new FontFamily("Arial");
// Test whether myFontFamily is available in Italic.
if(myFontFamily.IsStyleAvailable(FontStyle.Italic))
{
// Create a Font object using myFontFamily.
Font familyFont = new Font(myFontFamily, 16, FontStyle.Italic);
// Use familyFont to draw text to the screen.
e.Graphics.DrawString(
myFontFamily.Name + " is available in Italic",
familyFont,
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 ファミリ