Font 생성자

정의

지정된 기존 FontFontStyle을 사용하는 새 Font를 초기화합니다.

오버로드

Font(Font, FontStyle)

지정된 기존 FontFontStyle 열거형을 사용하는 새 Font를 초기화합니다.

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

지정된 크기, 스타일, 단위 및 문자 집합을 사용하여 새 Font를 초기화합니다.

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

지정된 크기, 스타일, 단위 및 문자 집합을 사용하여 새 Font를 초기화합니다.

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

지정된 크기, 스타일, 단위 및 문자 집합을 사용하여 새 Font를 초기화합니다.

Font(String, Single, FontStyle, GraphicsUnit)

지정된 크기, 스타일 및 단위를 사용하여 새 Font를 초기화합니다.

Font(FontFamily, Single, FontStyle, GraphicsUnit)

지정된 크기, 스타일 및 단위를 사용하여 새 Font를 초기화합니다.

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

지정된 크기, 스타일, 단위 및 문자 집합을 사용하여 새 Font를 초기화합니다.

Font(String, Single, FontStyle)

지정된 크기 및 스타일을 사용하여 새 Font를 초기화합니다.

Font(FontFamily, Single, GraphicsUnit)

지정된 크기 및 단위를 사용하여 새 Font를 초기화합니다. 스타일을 Regular로 설정합니다.

Font(FontFamily, Single, FontStyle)

지정된 크기 및 스타일을 사용하여 새 Font를 초기화합니다.

Font(String, Single)

지정된 크기를 사용하여 새 Font를 초기화합니다.

Font(FontFamily, Single)

지정된 크기를 사용하여 새 Font를 초기화합니다.

Font(String, Single, GraphicsUnit)

지정된 크기 및 단위를 사용하여 새 Font를 초기화합니다. 스타일은 Regular로 설정됩니다.

Font(Font, FontStyle)

Source:
Font.cs
Source:
Font.cs
Source:
Font.cs

지정된 기존 FontFontStyle 열거형을 사용하는 새 Font를 초기화합니다.

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를 만들 기존 Font입니다.

newStyle
FontStyle

Font에 적용할 FontStyle입니다. FontStyle 열거형의 여러 값은 OR 연산자와 함께 사용할 수 있습니다.

예제

다음 코드 예제에서는 연산자 Inequality , Font 생성자 및 속성을 보여 줍니다 Bold . 이 예제는 라는 Button2단추가 포함된 Windows Form과 함께 사용하도록 설계되었습니다. 다음 코드를 양식에 붙여넣고 메서드를 Button2_Click 단추의 Click 이벤트와 연결합니다.

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 이하 릴리스를 기반으로 하는 지역화된 애플리케이션의 경우 애플리케이션을 빌드하는 데 사용되는 컴퓨터에 해당 글꼴이 설치되지 않은 경우 에 대한 글꼴 prototype 을 지정하면 Microsoft Sans Serif 글꼴이 대신 사용됩니다. 이 동작에 종속 되는 애플리케이션을.NET Framework 3.0에 대 한 애플리케이션을 다시 컴파일해야 하는 경우에 Microsoft Sans Serif 글꼴을 지정 해야 prototype합니다.

적용 대상

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

Source:
Font.cs
Source:
Font.cs
Source:
Font.cs

지정된 크기, 스타일, 단위 및 문자 집합을 사용하여 새 Font를 초기화합니다.

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

Font에 대한 FontFamily의 문자열 표현입니다.

emSize
Single

unit 매개 변수에서 지정하는 단위로 측정된 새 글꼴의 em-size입니다.

style
FontStyle

새 글꼴의 FontStyle입니다.

unit
GraphicsUnit

새 글꼴의 GraphicsUnit입니다.

gdiCharSet
Byte

Byte 이 글꼴에 사용할 GDI 문자 집합을 지정하는 입니다.

gdiVerticalFont
Boolean

Font 가 GDI 세로 글꼴에서 파생되는지 여부를 나타내는 부울 값입니다.

예외

emSize가 0보다 작거나 같거나, 무한대로 계산되거나, 잘못된 수인 경우

설명

매개 변수는 gdiCharSet Windows SDK 헤더 파일 WinGDI.h에 정의된 목록에서 값을 사용합니다. 경우는 familyName Microsoft Sans Serif 글꼴을 애플리케이션을 실행 하는 컴퓨터에 설치 되어 있지 않거나 지원 되지 않는 대체 되는 매개 변수를 지정 합니다.

추가 정보

적용 대상

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

Source:
Font.cs
Source:
Font.cs
Source:
Font.cs

지정된 크기, 스타일, 단위 및 문자 집합을 사용하여 새 Font를 초기화합니다.

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

FontFontFamily입니다.

emSize
Single

unit 매개 변수에서 지정하는 단위로 측정된 새 글꼴의 em-size입니다.

style
FontStyle

새 글꼴의 FontStyle입니다.

unit
GraphicsUnit

새 글꼴의 GraphicsUnit입니다.

gdiCharSet
Byte

새 글꼴에 사용할 Byte 문자 집합을 지정하는

이 글꼴에 사용할 GDI 문자 집합입니다.

gdiVerticalFont
Boolean

새 글꼴이 GDI 세로 글꼴에서 파생되는지 여부를 나타내는 부울 값입니다.

예외

emSize가 0보다 작거나 같거나, 무한대로 계산되거나, 잘못된 수인 경우

familynull인 경우

설명

매개 변수는 gdiCharSet Windows SDK 헤더 파일 WinGDI.h에 정의된 목록에서 값을 사용합니다.

적용 대상

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

Source:
Font.cs
Source:
Font.cs
Source:
Font.cs

지정된 크기, 스타일, 단위 및 문자 집합을 사용하여 새 Font를 초기화합니다.

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

FontFontFamily입니다.

emSize
Single

unit 매개 변수에서 지정하는 단위로 측정된 새 글꼴의 em-size입니다.

style
FontStyle

새 글꼴의 FontStyle입니다.

unit
GraphicsUnit

새 글꼴의 GraphicsUnit입니다.

gdiCharSet
Byte

새 글꼴에 사용할 Byte 문자 집합을 지정하는

새 글꼴에 사용할 GDI 문자 집합입니다.

예외

emSize가 0보다 작거나 같거나, 무한대로 계산되거나, 잘못된 수인 경우

family이(가) null인 경우

설명

매개 변수는 gdiCharSet Windows SDK 헤더 파일 WinGDI.h에 정의된 목록에서 값을 사용합니다.

적용 대상

Font(String, Single, FontStyle, GraphicsUnit)

Source:
Font.cs
Source:
Font.cs
Source:
Font.cs

지정된 크기, 스타일 및 단위를 사용하여 새 Font를 초기화합니다.

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

Font에 대한 FontFamily의 문자열 표현입니다.

emSize
Single

unit 매개 변수에서 지정하는 단위로 측정된 새 글꼴의 em-size입니다.

style
FontStyle

새 글꼴의 FontStyle입니다.

unit
GraphicsUnit

새 글꼴의 GraphicsUnit입니다.

예외

emSize가 0보다 작거나 같거나, 무한대로 계산되거나, 잘못된 수인 경우

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 Font 생성자입니다. 이 예제는 Windows Forms 사용하도록 설계되었습니다. 이 예제를 실행하려면 이 코드를 라는 Button2단추가 포함된 양식에 붙여넣고 메서드를 단추의 이벤트와 Click 연결 Button2_Click 합니다.


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 애플리케이션 트루타입 글꼴을 지원 하 고 OpenType 글꼴에 대 한 지원이 제한 됩니다. 경우는 familyName Microsoft Sans Serif 글꼴을 애플리케이션을 실행 하는 컴퓨터에 설치 되어 있지 않거나 지원 되지 않는 대체 되는 매개 변수를 지정 합니다.

적용 대상

Font(FontFamily, Single, FontStyle, GraphicsUnit)

Source:
Font.cs
Source:
Font.cs
Source:
Font.cs

지정된 크기, 스타일 및 단위를 사용하여 새 Font를 초기화합니다.

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

FontFontFamily입니다.

emSize
Single

unit 매개 변수에서 지정하는 단위로 측정된 새 글꼴의 em-size입니다.

style
FontStyle

새 글꼴의 FontStyle입니다.

unit
GraphicsUnit

새 글꼴의 GraphicsUnit입니다.

예외

emSize가 0보다 작거나 같거나, 무한대로 계산되거나, 잘못된 수인 경우

family이(가) null인 경우

적용 대상

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

Source:
Font.cs
Source:
Font.cs
Source:
Font.cs

지정된 크기, 스타일, 단위 및 문자 집합을 사용하여 새 Font를 초기화합니다.

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

Font에 대한 FontFamily의 문자열 표현입니다.

emSize
Single

unit 매개 변수에서 지정하는 단위로 측정된 새 글꼴의 em-size입니다.

style
FontStyle

새 글꼴의 FontStyle입니다.

unit
GraphicsUnit

새 글꼴의 GraphicsUnit입니다.

gdiCharSet
Byte

Byte 이 글꼴에 사용할 GDI 문자 집합을 지정하는 입니다.

예외

emSize가 0보다 작거나 같거나, 무한대로 계산되거나, 잘못된 수인 경우

설명

매개 변수는 gdiCharSet Windows SDK 헤더 파일 WinGDI.h에 정의된 목록에서 값을 사용합니다. Windows Forms 애플리케이션 트루타입 글꼴을 지원 하 고 OpenType 글꼴에 대 한 지원이 제한 됩니다. 경우는 familyName Microsoft Sans Serif 글꼴을 애플리케이션을 실행 하는 컴퓨터에 설치 되어 있지 않거나 지원 되지 않는 대체 되는 매개 변수를 지정 합니다.

추가 정보

적용 대상

Font(String, Single, FontStyle)

Source:
Font.cs
Source:
Font.cs
Source:
Font.cs

지정된 크기 및 스타일을 사용하여 새 Font를 초기화합니다.

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

Font에 대한 FontFamily의 문자열 표현입니다.

emSize
Single

새 글꼴의 em size(포인트)입니다.

style
FontStyle

새 글꼴의 FontStyle입니다.

예외

emSize가 0보다 작거나 같거나, 무한대로 계산되거나, 잘못된 수인 경우

설명

결과 글꼴의 속성이 Unit 로 설정됩니다 Point. Windows Forms 애플리케이션 트루타입 글꼴을 지원 하 고 OpenType 글꼴에 대 한 지원이 제한 됩니다. 경우는 familyName Microsoft Sans Serif 글꼴을 애플리케이션을 실행 하는 컴퓨터에 설치 되어 있지 않거나 지원 되지 않는 대체 되는 매개 변수를 지정 합니다.

적용 대상

Font(FontFamily, Single, GraphicsUnit)

Source:
Font.cs
Source:
Font.cs
Source:
Font.cs

지정된 크기 및 단위를 사용하여 새 Font를 초기화합니다. 스타일을 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

FontFontFamily입니다.

emSize
Single

unit 매개 변수에서 지정하는 단위로 측정된 새 글꼴의 em-size입니다.

unit
GraphicsUnit

새 글꼴의 GraphicsUnit입니다.

예외

family이(가) null인 경우

emSize가 0보다 작거나 같거나, 무한대로 계산되거나, 잘못된 수인 경우

설명

결과 글꼴의 속성이 Style 로 설정됩니다 FontStyle.Regular.

적용 대상

Font(FontFamily, Single, FontStyle)

Source:
Font.cs
Source:
Font.cs
Source:
Font.cs

지정된 크기 및 스타일을 사용하여 새 Font를 초기화합니다.

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

FontFontFamily입니다.

emSize
Single

새 글꼴의 em size(포인트)입니다.

style
FontStyle

새 글꼴의 FontStyle입니다.

예외

emSize가 0보다 작거나 같거나, 무한대로 계산되거나, 잘못된 수인 경우

family이(가) null인 경우

예제

다음 코드 예제에서는 단추의 속성을 새 굵은 스타일로 Font설정하는 Font 방법을 보여 줍니다. 이 예제는 라는 Button1단추가 포함된 Windows Form과 함께 사용하도록 설계되었습니다. 다음 코드를 양식에 붙여넣고 메서드를 Button1_Click 단추의 Click 이벤트와 연결합니다.

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 로 설정됩니다 Point.

적용 대상

Font(String, Single)

Source:
Font.cs
Source:
Font.cs
Source:
Font.cs

지정된 크기를 사용하여 새 Font를 초기화합니다.

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

Font에 대한 FontFamily의 문자열 표현입니다.

emSize
Single

새 글꼴의 em size(포인트)입니다.

예외

emSize가 0보다 작거나 같거나, 무한대로 계산되거나, 잘못된 수인 경우

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 Font 생성자입니다. 이 예제는 Windows Form과 함께 사용하도록 설계되었으며 이벤트의 매개 변수 Paint 인 가 필요합니다.PaintEventArgse

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

설명

결과 글꼴의 속성이 StyleFontStyle.Regular 설정되고 해당 속성이 Unit 로 설정됩니다 GraphicsUnit.Point. Windows Forms 애플리케이션 트루타입 글꼴을 지원 하 고 OpenType 글꼴에 대 한 지원이 제한 됩니다. 경우는 familyName Microsoft Sans Serif 글꼴을 애플리케이션을 실행 하는 컴퓨터에 설치 되어 있지 않거나 지원 되지 않는 대체 되는 매개 변수를 지정 합니다.

적용 대상

Font(FontFamily, Single)

Source:
Font.cs
Source:
Font.cs
Source:
Font.cs

지정된 크기를 사용하여 새 Font를 초기화합니다.

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

FontFontFamily입니다.

emSize
Single

새 글꼴의 em size(포인트)입니다.

예외

emSize가 0보다 작거나 같거나, 무한대로 계산되거나, 잘못된 수인 경우

설명

결과 글꼴의 속성이 StyleRegular 설정되고 해당 속성이 Unit 로 설정됩니다 Point.

적용 대상

Font(String, Single, GraphicsUnit)

Source:
Font.cs
Source:
Font.cs
Source:
Font.cs

지정된 크기 및 단위를 사용하여 새 Font를 초기화합니다. 스타일은 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

Font에 대한 FontFamily의 문자열 표현입니다.

emSize
Single

unit 매개 변수에서 지정하는 단위로 측정된 새 글꼴의 em-size입니다.

unit
GraphicsUnit

새 글꼴의 GraphicsUnit입니다.

예외

emSize가 0보다 작거나 같거나, 무한대로 계산되거나, 잘못된 수인 경우

설명

결과 글꼴의 속성이 Style 로 설정됩니다 FontStyle.Regular.

적용 대상