Font コンストラクタとは? わかりやすく解説

Font コンストラクタ (String, Single)

指定したサイズ使用して新しFont初期化します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

例外例外
例外種類条件

ArgumentException

emSize が、0 以下であるか、無限大となるか、または有効な数値ではありません。

解説解説
使用例使用例

Font コンストラクタSize、SizeInPoints、および Unit の各プロパティ使用する方法次のコード例示します。この例は、ComboBox1 という名前の ComboBox に "Bigger" と "Smaller" という文字列設定されWindows フォームでの使用意図してデザインされています。そして、次のコードをそのフォーム貼り付けComboBox1_SelectedIndexChanged メソッドに、ComboBox コントロールの SelectedIndexChanged イベント関連付けます。

Private Sub ComboBox1_SelectedIndexChanged(ByVal
 sender As System.Object, _
    ByVal e As System.EventArgs) Handles
 ComboBox1.SelectedIndexChanged

    ' Cast the sender object back to a ComboBox.
    Dim ComboBox1 As ComboBox = CType(sender,
 ComboBox)

    ' Retrieve the selected item.
    Dim selectedString As String
 = CType(ComboBox1.SelectedItem, String)

    ' Convert it to lowercase.
    selectedString = selectedString.ToLower()

    ' Declare the current size.
    Dim currentSize As Single

    ' Switch on the selected item. 
    Select Case selectedString

        ' If Bigger is selected, get the current size from the 
        ' Size property and increase it. Reset the font to the
        '  new size, using the current unit.
    Case "bigger"
            currentSize = Label1.Font.Size
            currentSize += 2.0F
            Label1.Font = New Font(Label1.Font.Name, currentSize,
 _
                Label1.Font.Style, Label1.Font.Unit)

            ' If Smaller is selected, get the current size, in points
,
            ' and decrease it by 1.  Reset the font with the new size
            ' in points.
        Case "smaller"
            currentSize = Label1.Font.SizeInPoints
            currentSize -= 1
            Label1.Font = New Font(Label1.Font.Name, currentSize,
 _
                Label1.Font.Style)
    End Select
End Sub
private void ComboBox1_SelectedIndexChanged(System.Object
 sender, 
    System.EventArgs e)
{

    // Cast the sender object back to a ComboBox.
    ComboBox ComboBox1 = (ComboBox) sender;

    // Retrieve the selected item.
    string selectedString = (string) ComboBox1.SelectedItem;

    // Convert it to lowercase.
    selectedString = selectedString.ToLower();

    // Declare the current size.
    float currentSize;

    // Switch on the selected item. 
    switch(selectedString)
    {

            // If Bigger is selected, get the current size from the
 
            // Size property and increase it. Reset the font to the
            //  new size, using the current unit.
        case "bigger":
            currentSize = Label1.Font.Size;
            currentSize += 2.0F;
            Label1.Font = new Font(Label1.Font.Name, currentSize,
 
                Label1.Font.Style, Label1.Font.Unit);

            // If Smaller is selected, get the current size, in points
,
            // and decrease it by 1.  Reset the font with the new size
            // in points.
            break;
        case "smaller":
            currentSize = Label1.Font.SizeInPoints;
            currentSize -= 1;
            Label1.Font = new Font(Label1.Font.Name, currentSize,
 
                Label1.Font.Style);
            break;
    }
}
private:
    void ComboBox1_SelectedIndexChanged(System::Object^ sender
,
        System::EventArgs^ e)
    {

        // Cast the sender object back to a ComboBox.
        ComboBox^ ComboBox1 = (ComboBox^) sender;

        // Retrieve the selected item.
        String^ selectedString = (String^) ComboBox1->SelectedItem;

        // Convert it to lowercase.
        selectedString = selectedString->ToLower();

        // Declare the current size.
        float currentSize;

        // If Bigger is selected, get the current size from the 
        // Size property and increase it. Reset the font to the
        //  new size, using the current unit.
        if (selectedString == "bigger")
        {
            currentSize = Label1->Font->Size;
            currentSize += 2.0F;
            Label1->Font =gcnew System::Drawing::Font(Label1->Font->Name,
 
                currentSize, Label1->Font->Style, Label1->Font->Unit);

        }
        // If Smaller is selected, get the current size, in
        // points, and decrease it by 2.  Reset the font with
        // the new size in points.
        if (selectedString == "smaller")
        {
            currentSize = Label1->Font->Size;
            currentSize -= 2.0F;
            Label1->Font = gcnew System::Drawing::Font(Label1->Font->Name,
 
                currentSize, Label1->Font->Style);

        }
    }
private void comboBox1_SelectedIndexChanged(Object
 sender, 
    System.EventArgs e)
{
    // Cast the sender object back to a ComboBox.
    ComboBox comboBox1 = (ComboBox)sender;
    // Retrieve the selected item.
    String selectedString = (String)comboBox1.get_SelectedItem();
    // Convert it to lowercase.
    selectedString = selectedString.ToLower();
    // Declare the current size.
    float currentSize;
    // Switch on the selected item. 
    // If Bigger is selected, get the current size from the 
    // Size property and increase it. Reset the font to the
    //  new size, using the current unit.
    if (selectedString.Equals("bigger")) {
        currentSize = label1.get_Font().get_Size();
        currentSize += 2;
        label1.set_Font(new Font(label1.get_Font().get_Name(),
 
            currentSize, label1.get_Font().get_Style(), 
            label1.get_Font().get_Unit()));
    }
    else {
        // If Smaller is selected, get the current size, in points,
        // and decrease it by 1.  Reset the font with the new size
        // in points.
        if (selectedString.Equals("smaller")) {
            currentSize = label1.get_Font().get_SizeInPoints();
            currentSize -= 1;
            label1.set_Font(new Font(label1.get_Font().get_Name(),
 
                currentSize, label1.get_Font().get_Style()));
        }
    }
} //comboBox1_SelectedIndexChanged
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Font コンストラクタ (Device, Font)

既存フォントデバイス使用してFont クラス新しインスタンス初期化します。

名前空間: Microsoft.WindowsMobile.DirectX.Direct3D
アセンブリ: Microsoft.WindowsMobile.DirectX (microsoft.windowsmobile.directx.dll 内)
構文構文

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Font クラス
Font メンバ
Microsoft.WindowsMobile.DirectX.Direct3D 名前空間

Font コンストラクタ (Device, FontDescription)

既存デバイスフォント記述使用してFont クラス新しインスタンス初期化します。

名前空間: Microsoft.WindowsMobile.DirectX.Direct3D
アセンブリ: Microsoft.WindowsMobile.DirectX (microsoft.windowsmobile.directx.dll 内)
構文構文

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Font クラス
Font メンバ
Microsoft.WindowsMobile.DirectX.Direct3D 名前空間

Font コンストラクタ (FontFamily, Single, FontStyle)

指定したサイズスタイル使用して新しFont初期化します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub New ( _
    family As FontFamily, _
    emSize As Single, _
    style As FontStyle _
)
Dim family As FontFamily
Dim emSize As Single
Dim style As FontStyle

Dim instance As New Font(family,
 emSize, style)
public Font (
    FontFamily family,
    float emSize,
    FontStyle style
)
public:
Font (
    FontFamily^ family, 
    float emSize, 
    FontStyle style
)
public Font (
    FontFamily family, 
    float emSize, 
    FontStyle style
)
public function Font (
    family : FontFamily, 
    emSize : float, 
    style : FontStyle
)

パラメータ

family

新しFont の FontFamily。

emSize

新しフォントem サイズ (単位ポイント)。

style

新しフォントの FontStyle。

例外例外
例外種類条件

ArgumentException

emSize が、0 以下であるか、無限大となるか、または有効な数値ではありません。

ArgumentNullException

familynull 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

ボタンFont プロパティ新し太字スタイルFont設定する方法次のコード例示します。この例は、Button1 という名前のボタン含んだ Windows フォームでの使用意図してデザインされています。次のコードフォーム貼り付けButton1_Click メソッドボタンClick イベント関連付けます。

 Private Sub Button1_Click(ByVal
 sender As System.Object, _
    ByVal e As System.EventArgs) Handles
 Button1.Click
    If Not Button1.Font.Style = FontStyle.Bold
 Then
        Button1.Font = New Font(FontFamily.GenericSansSerif, _
            12.0F, FontStyle.Bold)
    End If
End Sub
private void Button1_Click(System.Object sender,
 System.EventArgs e)
{
    if (Button1.Font.Style != FontStyle.Bold)
            Button1.Font = new Font(FontFamily.GenericSansSerif
,
            12.0F, FontStyle.Bold);
}
private:
   void Button1_Click( System::Object^ /*sender*/, System::EventArgs^
 /*e*/ )
   {
      Button1->Font = gcnew System::Drawing::Font( FontFamily::GenericSansSerif,12.0F,FontStyle::Bold
 );
   }
private void button1_Click(Object sender, System.EventArgs
 e)
{
    button1.set_Font(new Font(FontFamily.get_GenericSansSerif(),
 12,
        FontStyle.Bold));
} //button1_Click
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Font コンストラクタ (FontFamily, Single, GraphicsUnit)

指定したサイズ単位使用して新しFont初期化します。スタイルを FontStyle.Regular に設定します

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub New ( _
    family As FontFamily, _
    emSize As Single, _
    unit As GraphicsUnit _
)
Dim family As FontFamily
Dim emSize As Single
Dim unit As GraphicsUnit

Dim instance As New Font(family,
 emSize, unit)
public Font (
    FontFamily family,
    float emSize,
    GraphicsUnit unit
)
public:
Font (
    FontFamily^ family, 
    float emSize, 
    GraphicsUnit unit
)
public Font (
    FontFamily family, 
    float emSize, 
    GraphicsUnit unit
)
public function Font (
    family : FontFamily, 
    emSize : float, 
    unit : GraphicsUnit
)

パラメータ

family

新しFont の FontFamily。

emSize

新しフォントem サイズ (単位unit パラメータ指定された値による)。

unit

新しフォントの GraphicsUnit。

例外例外
例外種類条件

ArgumentNullException

familynull 参照 (Visual Basic では Nothing) です。

ArgumentException

emSize が、0 以下であるか、無限大となるか、または有効な数値ではありません。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Font コンストラクタ (FontFamily, Single, FontStyle, GraphicsUnit)

指定したサイズスタイル、および単位使用して新しFont初期化します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub New ( _
    family As FontFamily, _
    emSize As Single, _
    style As FontStyle, _
    unit As GraphicsUnit _
)
Dim family As FontFamily
Dim emSize As Single
Dim style As FontStyle
Dim unit As GraphicsUnit

Dim instance As New Font(family,
 emSize, style, unit)
public Font (
    FontFamily family,
    float emSize,
    FontStyle style,
    GraphicsUnit unit
)
public:
Font (
    FontFamily^ family, 
    float emSize, 
    FontStyle style, 
    GraphicsUnit unit
)
public Font (
    FontFamily family, 
    float emSize, 
    FontStyle style, 
    GraphicsUnit unit
)
public function Font (
    family : FontFamily, 
    emSize : float, 
    style : FontStyle, 
    unit : GraphicsUnit
)

パラメータ

family

新しFont の FontFamily。

emSize

新しフォントem サイズ (単位unit パラメータ指定された値による)。

style

新しフォントの FontStyle。

unit

新しフォントの GraphicsUnit。

例外例外
例外種類条件

ArgumentException

emSize が、0 以下であるか、無限大となるか、または有効な数値ではありません。

ArgumentNullException

familynull 参照 (Visual Basic では Nothing) です。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Font コンストラクタ (FontFamily, Single, FontStyle, GraphicsUnit, Byte)

指定したサイズスタイル単位、および文字セット使用して新しFont初期化します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub New ( _
    family As FontFamily, _
    emSize As Single, _
    style As FontStyle, _
    unit As GraphicsUnit, _
    gdiCharSet As Byte _
)
Dim family As FontFamily
Dim emSize As Single
Dim style As FontStyle
Dim unit As GraphicsUnit
Dim gdiCharSet As Byte

Dim instance As New Font(family,
 emSize, style, unit, gdiCharSet)
public Font (
    FontFamily family,
    float emSize,
    FontStyle style,
    GraphicsUnit unit,
    byte gdiCharSet
)
public:
Font (
    FontFamily^ family, 
    float emSize, 
    FontStyle style, 
    GraphicsUnit unit, 
    unsigned char gdiCharSet
)
public Font (
    FontFamily family, 
    float emSize, 
    FontStyle style, 
    GraphicsUnit unit, 
    byte gdiCharSet
)
public function Font (
    family : FontFamily, 
    emSize : float, 
    style : FontStyle, 
    unit : GraphicsUnit, 
    gdiCharSet : byte
)

パラメータ

family

新しFont の FontFamily。

emSize

新しフォントem サイズ (単位unit パラメータ指定された値による)。

style

新しフォントの FontStyle。

unit

新しフォントの GraphicsUnit。

gdiCharSet

新しフォント使用する GDI 文字セット指定する Byte

例外例外
例外種類条件

ArgumentException

emSize が、0 以下であるか、無限大となるか、または有効な数値ではありません。

ArgumentNullException

familynull 参照 (Visual Basic では Nothing) です。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Font コンストラクタ (FontFamily, Single, FontStyle, GraphicsUnit, Byte, Boolean)

指定したサイズスタイル単位、および文字セット使用して新しFont初期化します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub New ( _
    family As FontFamily, _
    emSize As Single, _
    style As FontStyle, _
    unit As GraphicsUnit, _
    gdiCharSet As Byte, _
    gdiVerticalFont As Boolean _
)
Dim family As FontFamily
Dim emSize As Single
Dim style As FontStyle
Dim unit As GraphicsUnit
Dim gdiCharSet As Byte
Dim gdiVerticalFont As Boolean

Dim instance As New Font(family,
 emSize, style, unit, gdiCharSet, gdiVerticalFont)
public Font (
    FontFamily family,
    float emSize,
    FontStyle style,
    GraphicsUnit unit,
    byte gdiCharSet,
    bool gdiVerticalFont
)
public:
Font (
    FontFamily^ family, 
    float emSize, 
    FontStyle style, 
    GraphicsUnit unit, 
    unsigned char gdiCharSet, 
    bool gdiVerticalFont
)
public Font (
    FontFamily family, 
    float emSize, 
    FontStyle style, 
    GraphicsUnit unit, 
    byte gdiCharSet, 
    boolean gdiVerticalFont
)
public function Font (
    family : FontFamily, 
    emSize : float, 
    style : FontStyle, 
    unit : GraphicsUnit, 
    gdiCharSet : byte, 
    gdiVerticalFont : boolean
)

パラメータ

family

新しFont の FontFamily。

emSize

新しフォントem サイズ (単位unit パラメータ指定された値による)。

style

新しフォントの FontStyle。

unit

新しフォントの GraphicsUnit。

gdiCharSet

このフォント使用する GDI 文字セット指定する Byte

gdiVerticalFont

新しフォントGDI 縦書きフォントから派生したフォントかどうかを示すブール値。

例外例外
例外種類条件

ArgumentException

emSize が、0 以下であるか、無限大となるか、または有効な数値ではありません。

ArgumentNullException

family is null 参照 (Visual Basic では Nothing)

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Font コンストラクタ

指定した既存Font と FontStyle を使用する新しFont初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
Font (IntPtr) 指定したポインタ使用して新しFont初期化します。

.NET Compact Framework によってサポートされています。

Font (Font, FontStyle) 指定した既存FontFontStyle 列挙体を使用する新しFont初期化します。
Font (FontFamily, Single) 指定したサイズ使用して新しFont初期化します。
Font (String, Single) 指定したサイズ使用して新しFont初期化します。
Font (FontFamily, Single, FontStyle) 指定したサイズスタイル使用して新しFont初期化します。

.NET Compact Framework によってサポートされています。

Font (FontFamily, Single, GraphicsUnit) 指定したサイズ単位使用して新しFont初期化します。スタイルを FontStyle.Regular に設定します
Font (String, Single, FontStyle) 指定したサイズスタイル使用して新しFont初期化します。

.NET Compact Framework によってサポートされています。

Font (String, Single, GraphicsUnit) 指定したサイズ単位使用して新しFont初期化します。スタイルFontStyle.Regular設定されます。
Font (FontFamily, Single, FontStyle, GraphicsUnit) 指定したサイズスタイル、および単位使用して新しFont初期化します。
Font (String, Single, FontStyle, GraphicsUnit) 指定したサイズスタイル、および単位使用して新しFont初期化します。
Font (FontFamily, Single, FontStyle, GraphicsUnit, Byte) 指定したサイズスタイル単位、および文字セット使用して新しFont初期化します。
Font (String, Single, FontStyle, GraphicsUnit, Byte) 指定したサイズスタイル単位、および文字セット使用して新しFont初期化します。
Font (FontFamily, Single, FontStyle, GraphicsUnit, Byte, Boolean) 指定したサイズスタイル単位、および文字セット使用して新しFont初期化します。
Font (String, Single, FontStyle, GraphicsUnit, Byte, Boolean) 指定したサイズスタイル単位、および文字セット使用して新しFont初期化します。
参照参照

Font コンストラクタ (String, Single, FontStyle)

指定したサイズスタイル使用して新しFont初期化します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub New ( _
    familyName As String, _
    emSize As Single, _
    style As FontStyle _
)
public Font (
    string familyName,
    float emSize,
    FontStyle style
)
public:
Font (
    String^ familyName, 
    float emSize, 
    FontStyle style
)
public Font (
    String familyName, 
    float emSize, 
    FontStyle style
)
public function Font (
    familyName : String, 
    emSize : float, 
    style : FontStyle
)

パラメータ

familyName

新しFont対する FontFamily の文字列形式

emSize

新しフォントem サイズ (単位ポイント)。

style

新しフォントの FontStyle。

例外例外
例外種類条件

ArgumentException

emSize が、0 以下であるか、無限大となるか、または有効な数値ではありません。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Font コンストラクタ (IntPtr)


Font コンストラクタ (FontFamily, Single)

指定したサイズ使用して新しFont初期化します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub New ( _
    family As FontFamily, _
    emSize As Single _
)
Dim family As FontFamily
Dim emSize As Single

Dim instance As New Font(family,
 emSize)
public Font (
    FontFamily family,
    float emSize
)
public:
Font (
    FontFamily^ family, 
    float emSize
)
public Font (
    FontFamily family, 
    float emSize
)
public function Font (
    family : FontFamily, 
    emSize : float
)

パラメータ

family

新しFont の FontFamily。

emSize

新しフォントem サイズ (単位ポイント)。

例外例外
例外種類条件

ArgumentException

emSize が、0 以下であるか、無限大となるか、または有効な数値ではありません。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Font コンストラクタ (String, Single, FontStyle, GraphicsUnit, Byte, Boolean)

指定したサイズスタイル単位、および文字セット使用して新しFont初期化します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub New ( _
    familyName As String, _
    emSize As Single, _
    style As FontStyle, _
    unit As GraphicsUnit, _
    gdiCharSet As Byte, _
    gdiVerticalFont As Boolean _
)
Dim familyName As String
Dim emSize As Single
Dim style As FontStyle
Dim unit As GraphicsUnit
Dim gdiCharSet As Byte
Dim gdiVerticalFont As Boolean

Dim instance As New Font(familyName,
 emSize, style, unit, gdiCharSet, gdiVerticalFont)
public Font (
    string familyName,
    float emSize,
    FontStyle style,
    GraphicsUnit unit,
    byte gdiCharSet,
    bool gdiVerticalFont
)
public:
Font (
    String^ familyName, 
    float emSize, 
    FontStyle style, 
    GraphicsUnit unit, 
    unsigned char gdiCharSet, 
    bool gdiVerticalFont
)
public Font (
    String familyName, 
    float emSize, 
    FontStyle style, 
    GraphicsUnit unit, 
    byte gdiCharSet, 
    boolean gdiVerticalFont
)
public function Font (
    familyName : String, 
    emSize : float, 
    style : FontStyle, 
    unit : GraphicsUnit, 
    gdiCharSet : byte, 
    gdiVerticalFont : boolean
)

パラメータ

familyName

新しFont対する FontFamily の文字列形式

emSize

新しフォントem サイズ (単位unit パラメータ指定された値による)。

style

新しフォントの FontStyle。

unit

新しフォントの GraphicsUnit。

gdiCharSet

フォント使用する GDI 文字セット指定する Byte

gdiVerticalFont

新しFontGDI 縦書きフォントから派生したフォントかどうかを示すブール値。

例外例外
例外種類条件

ArgumentException

emSize が、0 以下であるか、無限大となるか、または有効な数値ではありません。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Font コンストラクタ (Font, FontStyle)

指定した既存FontFontStyle 列挙体を使用する新しFont初期化します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

使用例使用例

op_Inequality 演算子Font コンストラクタ、および Bold プロパティ使用するコード例次に示します。この例は、Button2 という名前のボタン含んだ Windows フォームでの使用意図してデザインされています。次のコードフォーム貼り付けButton2_Click メソッドボタンClick イベント関連付けます。

Private Sub Button2_Click(ByVal
 sender As System.Object, _
    ByVal e As System.EventArgs) Handles
 Button2.Click

    If (Color.op_Inequality(Me.BackColor, SystemColors.ControlDark))
 Then
        Me.BackColor = SystemColors.ControlDark
    End If
    If Not (Me.Font.Bold)
 Then
        Me.Font = New Font(Me.Font,
 FontStyle.Bold)
    End If
End Sub
private void Button2_Click(System.Object sender,
 System.EventArgs e)
{

    if (this.BackColor != SystemColors.ControlDark)
    {
        this.BackColor = SystemColors.ControlDark;
    }
    if (!(this.Font.Bold))
    {
        this.Font = new Font(this.Font,
 FontStyle.Bold);
    }
}
void Button2_Click( System::Object^ /*sender*/, System::EventArgs^
 /*e*/ )
{
   if ( this->BackColor != SystemColors::ControlDark
 )
   {
      this->BackColor = SystemColors::ControlDark;
   }

   if (  !(this->Font->Bold) )
   {
      this->Font = gcnew System::Drawing::Font( this->Font,FontStyle::Bold
 );
   }
}
private void button2_Click(System.Object sender,
 System.EventArgs e)
{
    if (!(this.get_BackColor().Equals(SystemColors.get_ControlDark())))
 {
        this.set_BackColor(SystemColors.get_ControlDark());
    }
    if (!(this.get_Font().get_Bold())) {
        this.set_Font(new Font(this.get_Font(),
 FontStyle.Bold));
    }
} //button2_Click
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Font コンストラクタ (String, Single, FontStyle, GraphicsUnit)

指定したサイズスタイル、および単位使用して新しFont初期化します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub New ( _
    familyName As String, _
    emSize As Single, _
    style As FontStyle, _
    unit As GraphicsUnit _
)
Dim familyName As String
Dim emSize As Single
Dim style As FontStyle
Dim unit As GraphicsUnit

Dim instance As New Font(familyName,
 emSize, style, unit)
public Font (
    string familyName,
    float emSize,
    FontStyle style,
    GraphicsUnit unit
)
public:
Font (
    String^ familyName, 
    float emSize, 
    FontStyle style, 
    GraphicsUnit unit
)
public Font (
    String familyName, 
    float emSize, 
    FontStyle style, 
    GraphicsUnit unit
)
public function Font (
    familyName : String, 
    emSize : float, 
    style : FontStyle, 
    unit : GraphicsUnit
)

パラメータ

familyName

新しFont対する FontFamily の文字列形式

emSize

新しフォントem サイズ (単位unit パラメータ指定された値による)。

style

新しフォントの FontStyle。

unit

新しフォントの GraphicsUnit。

例外例外
例外種類条件

ArgumentException

emSize が、0 以下であるか、無限大となるか、または有効な数値ではありません。

解説解説
使用例使用例

Font コンストラクタ使用する方法次のコード例示します。この例は、Windows フォームでの使用意図してデザインされています。この例を実行するには、このコードButton2 という名前のボタン配置されているフォーム貼り付けButton2_Click メソッドボタンClick イベント関連付けます。

Private Sub Button2_Click(ByVal
 sender As System.Object, _
    ByVal e As System.EventArgs) Handles
 Button2.Click

    Button2.Font = New Font(FontFamily.GenericMonospace, 12.0F,
 _
        FontStyle.Italic, GraphicsUnit.Pixel)

End Sub
private void Button2_Click(System.Object sender,
 System.EventArgs e)
{

    Button2.Font = new Font(FontFamily.GenericMonospace, 12.0F,
 
        FontStyle.Italic, GraphicsUnit.Pixel);

}
private:
    void Button2_Click(System::Object^ sender,
        System::EventArgs^ e)
    {
        Button2->Font = gcnew System::Drawing::Font
            (FontFamily::GenericMonospace, 12.0F,
            FontStyle::Italic, GraphicsUnit::Pixel);
    }
private void button2_Click(Object sender, System.EventArgs
 e)
{
    button2.set_Font(new Font(FontFamily.get_GenericMonospace(),
 12, 
        FontStyle.Italic, GraphicsUnit.Pixel));
} //button2_Click
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Font コンストラクタ (String, Single, GraphicsUnit)

指定したサイズ単位使用して新しFont初期化します。スタイルは FontStyle.Regular に設定されます。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub New ( _
    familyName As String, _
    emSize As Single, _
    unit As GraphicsUnit _
)
public Font (
    string familyName,
    float emSize,
    GraphicsUnit unit
)
public:
Font (
    String^ familyName, 
    float emSize, 
    GraphicsUnit unit
)
public Font (
    String familyName, 
    float emSize, 
    GraphicsUnit unit
)
public function Font (
    familyName : String, 
    emSize : float, 
    unit : GraphicsUnit
)

パラメータ

familyName

新しFont対する FontFamily の文字列形式

emSize

新しフォントem サイズ (単位unit パラメータ指定された値による)。

unit

新しフォントの GraphicsUnit。

例外例外
例外種類条件

ArgumentException

emSize が、0 以下であるか、無限大となるか、または有効な数値ではありません。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Font コンストラクタ (String, Single, FontStyle, GraphicsUnit, Byte)

指定したサイズスタイル単位、および文字セット使用して新しFont初期化します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub New ( _
    familyName As String, _
    emSize As Single, _
    style As FontStyle, _
    unit As GraphicsUnit, _
    gdiCharSet As Byte _
)
Dim familyName As String
Dim emSize As Single
Dim style As FontStyle
Dim unit As GraphicsUnit
Dim gdiCharSet As Byte

Dim instance As New Font(familyName,
 emSize, style, unit, gdiCharSet)
public Font (
    string familyName,
    float emSize,
    FontStyle style,
    GraphicsUnit unit,
    byte gdiCharSet
)
public:
Font (
    String^ familyName, 
    float emSize, 
    FontStyle style, 
    GraphicsUnit unit, 
    unsigned char gdiCharSet
)
public Font (
    String familyName, 
    float emSize, 
    FontStyle style, 
    GraphicsUnit unit, 
    byte gdiCharSet
)
public function Font (
    familyName : String, 
    emSize : float, 
    style : FontStyle, 
    unit : GraphicsUnit, 
    gdiCharSet : byte
)

パラメータ

familyName

新しFont対する FontFamily の文字列形式

emSize

新しフォントem サイズ (単位unit パラメータ指定された値による)。

style

新しフォントの FontStyle。

unit

新しフォントの GraphicsUnit。

gdiCharSet

フォント使用する GDI 文字セット指定する Byte

例外例外
例外種類条件

ArgumentException

emSize が、0 以下であるか、無限大となるか、または有効な数値ではありません。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Font コンストラクタ




英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Font コンストラクタ」の関連用語

Font コンストラクタのお隣キーワード

Font クラス

Font コンストラクタ

Font プロパティ

検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Font コンストラクタのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS