Control.DefaultBackColor Propriedade

Definição

Obtém a cor da tela de fundo padrão do controle.

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

Valor da propriedade

A tela de fundo padrão Color do controle. O padrão é Control.

Exemplos

O exemplo de código a seguir demonstra como usar os DefaultBackColormembros , DefaultFonte DefaultForeColor . Para executar o exemplo, cole o código a seguir em um formulário que contém um ListBox chamado ListBox1. Chame o Populate_ListBox método no construtor do formulário ou Load no método de tratamento de eventos.

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

Comentários

Esse é o valor da propriedade padrão BackColor de um controle genérico de nível superior. Classes derivadas podem ter padrões diferentes.

Aplica-se a

Confira também