Control.DefaultBackColor 속성

정의

컨트롤의 기본 배경색을 가져오거나 설정합니다.

public:
 static property System::Drawing::Color DefaultBackColor { System::Drawing::Color get(); };
public static System.Drawing.Color DefaultBackColor { get; }
static member DefaultBackColor : System.Drawing.Color
Public Shared ReadOnly Property DefaultBackColor As Color

속성 값

컨트롤의 기본 배경 Color입니다. 기본값은 Control입니다.

예제

다음 코드 예제에서는 사용 하는 방법을 보여 줍니다는 DefaultBackColor, DefaultFont, 및 DefaultForeColor 멤버입니다. 예제를 실행하려면 다음 코드를 ListBox1이라는 형식으로 ListBox 붙여넣습니다. 호출 된 Populate_ListBox 폼의 생성자 또는 Load 이벤트 처리 메서드.

// 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.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.

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

설명

제네릭 최상위 컨트롤의 기본 BackColor 속성 값입니다. 파생 클래스의 기본값은 다를 수 있습니다.

적용 대상

추가 정보