Control.DefaultBackColor Özellik

Tanım

Denetimin varsayılan arka plan rengini alır.

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

Özellik Değeri

Denetimin varsayılan arka planı Color . Varsayılan değer: Control.

Örnekler

Aşağıdaki kod örneğinde , DefaultFontve DefaultForeColor üyelerinin nasıl kullanılacağı DefaultBackColorgösterilmektedir. Örneği çalıştırmak için aşağıdaki kodu ListBox1 adlı bir ListBox forma yapıştırın. Formun Populate_ListBox oluşturucusunda veya Load olay işleme yönteminde yöntemini çağırın.

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

Açıklamalar

Bu, genel bir üst düzey denetimin varsayılan BackColor özellik değeridir. Türetilmiş sınıfların farklı varsayılanları olabilir.

Şunlara uygulanır

Ayrıca bkz.