Font 建構函式

定義

初始化使用指定之現有 FontFont 的新 FontStyleInitializes a new Font that uses the specified existing Font and FontStyle.

多載

Font(Font, FontStyle)

初始化使用指定之現有 FontFont 列舉的新 FontStyleInitializes a new Font that uses the specified existing Font and FontStyle enumeration.

Font(String, Single, FontStyle, GraphicsUnit, Byte, Boolean)

使用指定大小、樣式、單位和字元集,初始化新的 FontInitializes a new Font using the specified size, style, unit, and character set.

Font(FontFamily, Single, FontStyle, GraphicsUnit, Byte, Boolean)

使用指定大小、樣式、單位和字元集,初始化新的 FontInitializes a new Font using a specified size, style, unit, and character set.

Font(FontFamily, Single, FontStyle, GraphicsUnit, Byte)

使用指定大小、樣式、單位和字元集,初始化新的 FontInitializes a new Font using a specified size, style, unit, and character set.

Font(String, Single, FontStyle, GraphicsUnit)

使用指定大小、樣式和單位,初始化新的 FontInitializes a new Font using a specified size, style, and unit.

Font(FontFamily, Single, FontStyle, GraphicsUnit)

使用指定大小、樣式和單位,初始化新的 FontInitializes a new Font using a specified size, style, and unit.

Font(String, Single, FontStyle, GraphicsUnit, Byte)

使用指定大小、樣式、單位和字元集,初始化新的 FontInitializes a new Font using a specified size, style, unit, and character set.

Font(String, Single, FontStyle)

使用指定的大小和樣式,初始化新的 FontInitializes a new Font using a specified size and style.

Font(FontFamily, Single, GraphicsUnit)

使用指定大小和單位,初始化新的 FontInitializes a new Font using a specified size and unit. 將樣式設為 RegularSets the style to Regular.

Font(FontFamily, Single, FontStyle)

使用指定的大小和樣式,初始化新的 FontInitializes a new Font using a specified size and style.

Font(String, Single)

使用指定的大小,初始化新的 FontInitializes a new Font using a specified size.

Font(FontFamily, Single)

使用指定的大小,初始化新的 FontInitializes a new Font using a specified size.

Font(String, Single, GraphicsUnit)

使用指定大小和單位,初始化新的 FontInitializes a new Font using a specified size and unit. 樣式設定為 RegularThe style is set to Regular.

Font(Font, FontStyle)

初始化使用指定之現有 FontFont 列舉的新 FontStyleInitializes a new Font that uses the specified existing Font and FontStyle enumeration.

public:
 Font(System::Drawing::Font ^ prototype, System::Drawing::FontStyle newStyle);
public Font (System.Drawing.Font prototype, System.Drawing.FontStyle newStyle);
new System.Drawing.Font : System.Drawing.Font * System.Drawing.FontStyle -> System.Drawing.Font
Public Sub New (prototype As Font, newStyle As FontStyle)

參數

prototype
Font

用來建立新 Font 的現有 FontThe existing Font from which to create the new Font.

newStyle
FontStyle

要套用至新 FontStyleFontThe FontStyle to apply to the new Font. FontStyle 列舉的多個值可以與 OR 運算子相結合。Multiple values of the FontStyle enumeration can be combined with the OR operator.

範例

下列程式碼範例示範 Inequality 運算子、Font 的函式和 Bold 屬性。The following code example demonstrates the Inequality operator, the Font constructor, and the Bold property. 這個範例是設計來搭配 Windows Form 使用,其中包含名為 Button2的按鈕。This example is designed to be used with a Windows Form that contains a button named Button2. 將下列程式碼貼到您的表單中,並將 Button2_Click 方法與按鈕的 Click 事件產生關聯。Paste the following code into your form and associate the Button2_Click method with the button's Click event.

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.BackColor != SystemColors.ControlDark)
    {
        this.BackColor = SystemColors.ControlDark;
    }
    if (!(this.Font.Bold))
    {
        this.Font = new Font(this.Font, FontStyle.Bold);
    }
}
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

備註

針對以 .NET Framework 2.0.NET Framework 2.0 和較早版本為基礎的當地語系化應用程式,指定在用來建立應用程式的電腦上未安裝該字型的 prototype 字型,將會改為使用 Microsoft Sans Serif 字型。For localized applications that are based on the .NET Framework 2.0.NET Framework 2.0 and earlier releases, specifying a font for prototype when that font has not been installed on the computer that is used to build your application will cause the Microsoft Sans Serif font to be used instead. 如果您的應用程式相依于此行為,而且您必須針對 .NET Framework 3.0 重新編譯應用程式,您應該指定 prototype的 Microsoft Sans Serif 字型。If your application depends on this behavior and you must recompile your application for the .NET Framework 3.0, you should specify the Microsoft Sans Serif font for prototype.

Font(String, Single, FontStyle, GraphicsUnit, Byte, Boolean)

使用指定大小、樣式、單位和字元集,初始化新的 FontInitializes a new Font using the specified size, style, unit, and character set.

public:
 Font(System::String ^ familyName, float emSize, System::Drawing::FontStyle style, System::Drawing::GraphicsUnit unit, System::Byte gdiCharSet, bool gdiVerticalFont);
public Font (string familyName, float emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont);
new System.Drawing.Font : string * single * System.Drawing.FontStyle * System.Drawing.GraphicsUnit * byte * bool -> System.Drawing.Font
Public Sub New (familyName As String, emSize As Single, style As FontStyle, unit As GraphicsUnit, gdiCharSet As Byte, gdiVerticalFont As Boolean)

參數

familyName
String

FontFamilyFont 的字串表示。A string representation of the FontFamily for the new Font.

emSize
Single

新字型的 Em 大小,以 unit 參數所指定的單位計算。The em-size of the new font in the units specified by the unit parameter.

style
FontStyle

新字型的 FontStyleThe FontStyle of the new font.

unit
GraphicsUnit

新字型的 GraphicsUnitThe GraphicsUnit of the new font.

gdiCharSet
Byte

Byte,指定要用於這個字型的 GDIGDI 字元集。A Byte that specifies a GDIGDI character set to use for this font.

gdiVerticalFont
Boolean

布林值,表示新的 Font 是否衍生自 GDIGDI 垂直字型。A Boolean value indicating whether the new Font is derived from a GDIGDI vertical font.

例外狀況

emSize 小於或等於 0、評估為無限,或為無效數字。emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.

備註

gdiCharSet 參數會接受 Windows SDK 標頭檔 WinGDI 中定義的清單值。The gdiCharSet parameter takes a value from the list defined in the Windows SDK header file WinGDI.h. 如果 familyName 參數指定的字型未安裝在執行應用程式的電腦上或不受支援,則會替代 Microsoft Sans Serif。If the familyName parameter specifies a font that is not installed on the machine running the application or is not supported, Microsoft Sans Serif will be substituted.

另請參閱

Font(FontFamily, Single, FontStyle, GraphicsUnit, Byte, Boolean)

使用指定大小、樣式、單位和字元集,初始化新的 FontInitializes a new Font using a specified size, style, unit, and character set.

public:
 Font(System::Drawing::FontFamily ^ family, float emSize, System::Drawing::FontStyle style, System::Drawing::GraphicsUnit unit, System::Byte gdiCharSet, bool gdiVerticalFont);
public Font (System.Drawing.FontFamily family, float emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont);
new System.Drawing.Font : System.Drawing.FontFamily * single * System.Drawing.FontStyle * System.Drawing.GraphicsUnit * byte * bool -> System.Drawing.Font
Public Sub New (family As FontFamily, emSize As Single, style As FontStyle, unit As GraphicsUnit, gdiCharSet As Byte, gdiVerticalFont As Boolean)

參數

family
FontFamily

FontFamilyFontThe FontFamily of the new Font.

emSize
Single

新字型的 Em 大小,以 unit 參數所指定的單位計算。The em-size of the new font in the units specified by the unit parameter.

style
FontStyle

新字型的 FontStyleThe FontStyle of the new font.

unit
GraphicsUnit

新字型的 GraphicsUnitThe GraphicsUnit of the new font.

gdiCharSet
Byte

Byte,指定A Byte that specifies a 用於此字型的 GDIGDI 字元集。GDIGDI character set to use for this font.

gdiVerticalFont
Boolean

布林值,表示新字型是否衍生自 GDIGDI 垂直字型。A Boolean value indicating whether the new font is derived from a GDIGDI vertical font.

例外狀況

emSize 小於或等於 0、評估為無限,或為無效數字。emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.

familynullfamily is null

備註

gdiCharSet 參數會接受 Windows SDK 標頭檔 WinGDI 中定義的清單值。The gdiCharSet parameter takes a value from the list defined in the Windows SDK header file WinGDI.h.

Font(FontFamily, Single, FontStyle, GraphicsUnit, Byte)

使用指定大小、樣式、單位和字元集,初始化新的 FontInitializes a new Font using a specified size, style, unit, and character set.

public:
 Font(System::Drawing::FontFamily ^ family, float emSize, System::Drawing::FontStyle style, System::Drawing::GraphicsUnit unit, System::Byte gdiCharSet);
public Font (System.Drawing.FontFamily family, float emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit, byte gdiCharSet);
new System.Drawing.Font : System.Drawing.FontFamily * single * System.Drawing.FontStyle * System.Drawing.GraphicsUnit * byte -> System.Drawing.Font
Public Sub New (family As FontFamily, emSize As Single, style As FontStyle, unit As GraphicsUnit, gdiCharSet As Byte)

參數

family
FontFamily

FontFamilyFontThe FontFamily of the new Font.

emSize
Single

新字型的 Em 大小,以 unit 參數所指定的單位計算。The em-size of the new font in the units specified by the unit parameter.

style
FontStyle

新字型的 FontStyleThe FontStyle of the new font.

unit
GraphicsUnit

新字型的 GraphicsUnitThe GraphicsUnit of the new font.

gdiCharSet
Byte

Byte,指定A Byte that specifies a 用於新字型的 GDIGDI 字元集。GDIGDI character set to use for the new font.

例外狀況

emSize 小於或等於 0、評估為無限,或為無效數字。emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.

familynullfamily is null.

備註

gdiCharSet 參數會接受 Windows SDK 標頭檔 WinGDI 中定義的清單值。The gdiCharSet parameter takes a value from the list defined in the Windows SDK header file WinGDI.h.

Font(String, Single, FontStyle, GraphicsUnit)

使用指定大小、樣式和單位,初始化新的 FontInitializes a new Font using a specified size, style, and unit.

public:
 Font(System::String ^ familyName, float emSize, System::Drawing::FontStyle style, System::Drawing::GraphicsUnit unit);
public Font (string familyName, float emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit);
new System.Drawing.Font : string * single * System.Drawing.FontStyle * System.Drawing.GraphicsUnit -> System.Drawing.Font
Public Sub New (familyName As String, emSize As Single, style As FontStyle, unit As GraphicsUnit)

參數

familyName
String

FontFamilyFont 的字串表示。A string representation of the FontFamily for the new Font.

emSize
Single

新字型的 Em 大小,以 unit 參數所指定的單位計算。The em-size of the new font in the units specified by the unit parameter.

style
FontStyle

新字型的 FontStyleThe FontStyle of the new font.

unit
GraphicsUnit

新字型的 GraphicsUnitThe GraphicsUnit of the new font.

例外狀況

emSize 小於或等於 0、評估為無限,或為無效數字。emSize is less than or equal to 0, evaluates to infinity or is not a valid number.

範例

下列程式碼範例示範如何使用 Font 的函式。The following code example demonstrates how to use the Font constructor. 這個範例是設計來與 Windows Forms 搭配使用。This example is designed to be used with Windows Forms. 若要執行此範例,請將此程式碼貼入包含名為 Button2之按鈕的表單中,並將 Button2_Click 方法與按鈕的 Click 事件產生關聯。To run this example, paste this code into a form that contains a button named Button2, and associate the Button2_Click method with the Click event of the button.


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(System.Object sender, System.EventArgs e)
{

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

}

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

備註

Windows Forms 應用程式支援 TrueType 字型,而且對 OpenType 字型的支援有限。Windows Forms applications support TrueType fonts and have limited support for OpenType fonts. 如果 familyName 參數指定的字型未安裝在執行應用程式的電腦上或不受支援,則會替代 Microsoft Sans Serif。If the familyName parameter specifies a font that is not installed on the machine running the application or is not supported, Microsoft Sans Serif will be substituted.

Font(FontFamily, Single, FontStyle, GraphicsUnit)

使用指定大小、樣式和單位,初始化新的 FontInitializes a new Font using a specified size, style, and unit.

public:
 Font(System::Drawing::FontFamily ^ family, float emSize, System::Drawing::FontStyle style, System::Drawing::GraphicsUnit unit);
public Font (System.Drawing.FontFamily family, float emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit);
new System.Drawing.Font : System.Drawing.FontFamily * single * System.Drawing.FontStyle * System.Drawing.GraphicsUnit -> System.Drawing.Font
Public Sub New (family As FontFamily, emSize As Single, style As FontStyle, unit As GraphicsUnit)

參數

family
FontFamily

FontFamilyFontThe FontFamily of the new Font.

emSize
Single

新字型的 Em 大小,以 unit 參數所指定的單位計算。The em-size of the new font in the units specified by the unit parameter.

style
FontStyle

新字型的 FontStyleThe FontStyle of the new font.

unit
GraphicsUnit

新字型的 GraphicsUnitThe GraphicsUnit of the new font.

例外狀況

emSize 小於或等於 0、評估為無限,或為無效數字。emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.

familynullfamily is null.

Font(String, Single, FontStyle, GraphicsUnit, Byte)

使用指定大小、樣式、單位和字元集,初始化新的 FontInitializes a new Font using a specified size, style, unit, and character set.

public:
 Font(System::String ^ familyName, float emSize, System::Drawing::FontStyle style, System::Drawing::GraphicsUnit unit, System::Byte gdiCharSet);
public Font (string familyName, float emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit, byte gdiCharSet);
new System.Drawing.Font : string * single * System.Drawing.FontStyle * System.Drawing.GraphicsUnit * byte -> System.Drawing.Font
Public Sub New (familyName As String, emSize As Single, style As FontStyle, unit As GraphicsUnit, gdiCharSet As Byte)

參數

familyName
String

FontFamilyFont 的字串表示。A string representation of the FontFamily for the new Font.

emSize
Single

新字型的 Em 大小,以 unit 參數所指定的單位計算。The em-size of the new font in the units specified by the unit parameter.

style
FontStyle

新字型的 FontStyleThe FontStyle of the new font.

unit
GraphicsUnit

新字型的 GraphicsUnitThe GraphicsUnit of the new font.

gdiCharSet
Byte

Byte,指定要用於這個字型的 GDIGDI 字元集。A Byte that specifies a GDIGDI character set to use for this font.

例外狀況

emSize 小於或等於 0、評估為無限,或為無效數字。emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.

備註

gdiCharSet 參數會接受 Windows SDK 標頭檔 WinGDI 中定義的清單值。The gdiCharSet parameter takes a value from the list defined in the Windows SDK header file WinGDI.h. Windows Forms 應用程式支援 TrueType 字型,而且對 OpenType 字型的支援有限。Windows Forms applications support TrueType fonts and have limited support for OpenType fonts. 如果 familyName 參數指定的字型未安裝在執行應用程式的電腦上或不受支援,則會替代 Microsoft Sans Serif。If the familyName parameter specifies a font that is not installed on the machine running the application or is not supported, Microsoft Sans Serif will be substituted.

另請參閱

Font(String, Single, FontStyle)

使用指定的大小和樣式,初始化新的 FontInitializes a new Font using a specified size and style.

public:
 Font(System::String ^ familyName, float emSize, System::Drawing::FontStyle style);
public Font (string familyName, float emSize, System.Drawing.FontStyle style);
new System.Drawing.Font : string * single * System.Drawing.FontStyle -> System.Drawing.Font
Public Sub New (familyName As String, emSize As Single, style As FontStyle)

參數

familyName
String

FontFamilyFont 的字串表示。A string representation of the FontFamily for the new Font.

emSize
Single

新字型的 Em 大小 (以點計算)。The em-size, in points, of the new font.

style
FontStyle

新字型的 FontStyleThe FontStyle of the new font.

例外狀況

emSize 小於或等於 0、評估為無限,或為無效數字。emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.

備註

產生的字型將其 Unit 屬性設為 PointThe resulting font has its Unit property set to Point. Windows Forms 應用程式支援 TrueType 字型,而且對 OpenType 字型的支援有限。Windows Forms applications support TrueType fonts and have limited support for OpenType fonts. 如果 familyName 參數指定的字型未安裝在執行應用程式的電腦上或不受支援,則會替代 Microsoft Sans Serif。If the familyName parameter specifies a font that is not installed on the machine running the application or is not supported, Microsoft Sans Serif will be substituted.

Font(FontFamily, Single, GraphicsUnit)

使用指定大小和單位,初始化新的 FontInitializes a new Font using a specified size and unit. 將樣式設為 RegularSets the style to Regular.

public:
 Font(System::Drawing::FontFamily ^ family, float emSize, System::Drawing::GraphicsUnit unit);
public Font (System.Drawing.FontFamily family, float emSize, System.Drawing.GraphicsUnit unit);
new System.Drawing.Font : System.Drawing.FontFamily * single * System.Drawing.GraphicsUnit -> System.Drawing.Font
Public Sub New (family As FontFamily, emSize As Single, unit As GraphicsUnit)

參數

family
FontFamily

FontFamilyFontThe FontFamily of the new Font.

emSize
Single

新字型的 Em 大小,以 unit 參數所指定的單位計算。The em-size of the new font in the units specified by the unit parameter.

unit
GraphicsUnit

新字型的 GraphicsUnitThe GraphicsUnit of the new font.

例外狀況

familynullfamily is null.

emSize 小於或等於 0、評估為無限,或為無效數字。emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.

備註

產生的字型將其 Style 屬性設為 FontStyle.RegularThe resulting font has its Style property set to FontStyle.Regular.

Font(FontFamily, Single, FontStyle)

使用指定的大小和樣式,初始化新的 FontInitializes a new Font using a specified size and style.

public:
 Font(System::Drawing::FontFamily ^ family, float emSize, System::Drawing::FontStyle style);
public Font (System.Drawing.FontFamily family, float emSize, System.Drawing.FontStyle style);
new System.Drawing.Font : System.Drawing.FontFamily * single * System.Drawing.FontStyle -> System.Drawing.Font
Public Sub New (family As FontFamily, emSize As Single, style As FontStyle)

參數

family
FontFamily

FontFamilyFontThe FontFamily of the new Font.

emSize
Single

新字型的 Em 大小 (以點計算)。The em-size, in points, of the new font.

style
FontStyle

新字型的 FontStyleThe FontStyle of the new font.

例外狀況

emSize 小於或等於 0、評估為無限,或為無效數字。emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.

familynullfamily is null.

範例

下列程式碼範例示範如何將按鈕的 Font 屬性設定為新的粗體樣式 FontThe following code example demonstrates how to set the Font property of a button to a new, bold-style Font. 這個範例是設計來搭配 Windows Form 使用,其中包含名為 Button1的按鈕。This example is designed to be used with a Windows Form that contains a button named Button1. 將下列程式碼貼到您的表單中,並將 Button1_Click 方法與按鈕的 Click 事件產生關聯。Paste the following code into your form and associate the Button1_Click method with the button's Click event.

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(System.Object sender, System.EventArgs e)
{
    if (Button1.Font.Style != FontStyle.Bold)
            Button1.Font = new Font(FontFamily.GenericSansSerif,
            12.0F, FontStyle.Bold);
}
 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

備註

產生的字型將其 Unit 屬性設為 PointThe resulting font has its Unit property set to Point.

Font(String, Single)

使用指定的大小,初始化新的 FontInitializes a new Font using a specified size.

public:
 Font(System::String ^ familyName, float emSize);
public Font (string familyName, float emSize);
new System.Drawing.Font : string * single -> System.Drawing.Font
Public Sub New (familyName As String, emSize As Single)

參數

familyName
String

FontFamilyFont 的字串表示。A string representation of the FontFamily for the new Font.

emSize
Single

新字型的 Em 大小 (以點計算)。The em-size, in points, of the new font.

例外狀況

emSize 小於或等於 0、評估為無限,或為無效數字。emSize is less than or equal to 0, evaluates to infinity or is not a valid number.

範例

下列程式碼範例示範如何使用 Font 的函式。The following code example demonstrates how to use the Font constructor. 這個範例是設計來搭配 Windows Form 使用,而且需要 PaintEventArgse,這是 Paint 事件的參數。This example is designed to be used with a Windows Form and requires a PaintEventArgse, which is a parameter of the Paint event.

private void ConstructFontWithString(PaintEventArgs e)
{
    Font font1 = new Font("Arial", 20);
    e.Graphics.DrawString("Arial Font", font1, Brushes.Red, new PointF(10, 10));
}
Private Sub ConstructFontWithString(ByVal e As PaintEventArgs)
    Dim font1 As New Font("Arial", 20)
    e.Graphics.DrawString("Arial Font", font1, Brushes.Red, New PointF(10, 10))
End Sub

備註

產生的字型將其 Style 屬性設定為 FontStyle.Regular 並將其 Unit 屬性設定為 GraphicsUnit.PointThe resulting font has its Style property set to FontStyle.Regular and its Unit property set to GraphicsUnit.Point. Windows Forms 應用程式支援 TrueType 字型,而且對 OpenType 字型的支援有限。Windows Forms applications support TrueType fonts and have limited support for OpenType fonts. 如果 familyName 參數指定的字型未安裝在執行應用程式的電腦上或不受支援,則會替代 Microsoft Sans Serif。If the familyName parameter specifies a font that is not installed on the machine running the application or is not supported, Microsoft Sans Serif will be substituted.

Font(FontFamily, Single)

使用指定的大小,初始化新的 FontInitializes a new Font using a specified size.

public:
 Font(System::Drawing::FontFamily ^ family, float emSize);
public Font (System.Drawing.FontFamily family, float emSize);
new System.Drawing.Font : System.Drawing.FontFamily * single -> System.Drawing.Font
Public Sub New (family As FontFamily, emSize As Single)

參數

family
FontFamily

FontFamilyFontThe FontFamily of the new Font.

emSize
Single

新字型的 Em 大小 (以點計算)。The em-size, in points, of the new font.

例外狀況

emSize 小於或等於 0、評估為無限,或為無效數字。emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.

備註

產生的字型將其 Style 屬性設定為 Regular 並將其 Unit 屬性設定為 PointThe resulting font has its Style property set to Regular and its Unit property set to Point.

Font(String, Single, GraphicsUnit)

使用指定大小和單位,初始化新的 FontInitializes a new Font using a specified size and unit. 樣式設定為 RegularThe style is set to Regular.

public:
 Font(System::String ^ familyName, float emSize, System::Drawing::GraphicsUnit unit);
public Font (string familyName, float emSize, System.Drawing.GraphicsUnit unit);
new System.Drawing.Font : string * single * System.Drawing.GraphicsUnit -> System.Drawing.Font
Public Sub New (familyName As String, emSize As Single, unit As GraphicsUnit)

參數

familyName
String

FontFamilyFont 的字串表示。A string representation of the FontFamily for the new Font.

emSize
Single

新字型的 Em 大小,以 unit 參數所指定的單位計算。The em-size of the new font in the units specified by the unit parameter.

unit
GraphicsUnit

新字型的 GraphicsUnitThe GraphicsUnit of the new font.

例外狀況

emSize 小於或等於 0、評估為無限,或為無效數字。emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.

備註

產生的字型將其 Style 屬性設為 FontStyle.RegularThe resulting font has its Style property set to FontStyle.Regular.

適用於