Control.DefaultBackColor (Propiedad)
Ensamblado: System.Windows.Forms (en system.windows.forms.dll)
/** @property */ public static Color get_DefaultBackColor ()
public static function get DefaultBackColor () : Color
No aplicable.
Valor de propiedad
Color de fondo predeterminado del control. El valor predeterminado es SystemColors.Control.Éste es el valor predeterminado de la propiedad BackColor de un control genérico de nivel superior. Las clases derivadas pueden tener distintos valores predeterminados.
En el siguiente ejemplo de código se muestra cómo usar los miembros de DefaultBackColor, DefaultFont, y DefaultForeColor. Para ejecutar el ejemplo, pegue el siguiente código en un formulario que contenga un control ListBox denominado ListBox1. Llame al método Populate_ListBox en el constructor del formulario o en el método de control de eventos 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. 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 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 Service Pack 4, Windows CE, Windows Millennium, Windows Mobile para Pocket PC, Windows Mobile para Smartphone, Windows Server 2003, Windows XP Media Center, Windows XP Professional x64, Windows XP SP2, Windows XP Starter
Microsoft .NET Framework 3.0 es compatible con Windows Vista, Microsoft Windows XP SP2 y Windows Server 2003 SP1.