다음을 통해 공유


Control.DefaultFont 속성

컨트롤의 기본 글꼴을 가져옵니다.

네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)

구문

‘선언
Public Shared ReadOnly Property DefaultFont As Font
‘사용 방법
Dim value As Font

value = Control.DefaultFont
public static Font DefaultFont { get; }
public:
static property Font^ DefaultFont {
    Font^ get ();
}
/** @property */
public static Font get_DefaultFont ()
public static function get DefaultFont () : Font

속성 값

컨트롤의 기본 Font입니다. 반환되는 값은 운영 체제와 시스템의 로컬 culture 설정에 따라 다릅니다.

예외

예외 형식 조건

ArgumentException

클라이언트 컴퓨터에 기본 글꼴이나 국가별 대체 글꼴이 설치되어 있지 않은 경우

설명

다음 표에서는 운영 체제 및 로컬 culture에 따라 DefaultFont에서 반환하는 값에 대해 설명합니다.

시스템 및/또는 culture

글꼴

Windows NT 4x, 일본어 버전

MS UI 고딕, 9포인트

아랍어 Windows

Tahoma, 8포인트

기타 운영 체제/culture

MS Shell Dlg 논리 글꼴(일반적으로 Microsoft San Serif 8포인트)

MS Shell Dlg는 시스템 레지스트리에 설정된 글꼴에 매핑됩니다.

이전 글꼴이 설치되어 있지 않은 경우 기본 글꼴은 Tahoma, 8포인트입니다. Tahoma, 8포인트가 설치되어 있지 않은 경우 DefaultFontGenericSansSerif 속성 값을 반환합니다.

예제

다음 코드 예제에서는 DefaultBackColor, DefaultFontDefaultForeColor 멤버를 사용하는 방법을 보여 줍니다. 이 예제를 실행하려면 ListBox1이라는 ListBox가 들어 있는 폼에 다음 코드를 붙여넣고 폼의 생성자나 Load 이벤트 처리 메서드에서 Populate_ListBox 메서드를 호출합니다.

' The following method displays the default font, 
' background color and foreground color values for the ListBox  
' control. The values are displayed in the ListBox, itself.

Private Sub Populate_ListBox()
    ListBox1.Dock = DockStyle.Bottom

    ' Display the values in the read-only properties 
    ' DefaultBackColor, DefaultFont, DefaultForecolor.
    ListBox1.Items.Add("Default BackColor: " & ListBox.DefaultBackColor.ToString)
    ListBox1.Items.Add("Default Font: " & ListBox.DefaultFont.ToString)
    ListBox1.Items.Add("Default ForeColor:" & ListBox.DefaultForeColor.ToString)

End Sub
// The following method displays the default font, 
// background color and foreground color values for the ListBox  
// control. The values are displayed in the ListBox, itself.

private void Populate_ListBox()
{
    ListBox1.Dock = DockStyle.Bottom;

    // Display the values in the read-only properties 
    // DefaultBackColor, DefaultFont, DefaultForecolor.
    ListBox1.Items.Add("Default BackColor: " + 
        ListBox.DefaultBackColor.ToString());
    ListBox1.Items.Add("Default Font: " + 
        ListBox.DefaultFont.ToString());
    ListBox1.Items.Add("Default ForeColor:" + 
        ListBox.DefaultForeColor.ToString());

}
// The following method displays the default font, 
// background color and foreground color values for the ListBox  
// control. The values are displayed in the ListBox, itself.
void Populate_ListBox()
{
   ListBox1->Dock = DockStyle::Bottom;
   
   // Display the values in the read-only properties 
   // DefaultBackColor, DefaultFont, DefaultForecolor.
   ListBox1->Items->Add( String::Format( "Default BackColor: {0}", ListBox::DefaultBackColor ) );
   ListBox1->Items->Add( String::Format( "Default Font: {0}", ListBox::DefaultFont ) );
   ListBox1->Items->Add( String::Format( "Default ForeColor:{0}", ListBox::DefaultForeColor ) );
}
// The following method displays the default font, 
// background color and foreground color values for the ListBox  
// control. The values are displayed in the ListBox, itself.
private void Populate_ListBox()
{
    listBox1.set_Dock(DockStyle.Bottom);
    // Display the values in the read-only properties 
    // DefaultBackColor, DefaultFont, DefaultForecolor.
    listBox1.get_Items().Add("Default BackColor: " 
        + ListBox.get_DefaultBackColor().ToString());
    listBox1.get_Items().Add("Default Font: " 
        + ListBox.get_DefaultFont().ToString());
    listBox1.get_Items().Add("Default ForeColor:" 
        + ListBox.get_DefaultForeColor().ToString());
} //Populate_ListBox

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

Control 클래스
Control 멤버
System.Windows.Forms 네임스페이스
Control.Font
Font