Export (0) Print
Expand All
Expand Minimize
0 out of 1 rated this helpful - Rate this topic

Control.BackColor Property

Gets or sets the background color for the control.

[Visual Basic]
Public Overridable Property BackColor As Color
[C#]
public virtual Color BackColor {get; set;}
[C++]
public: __property virtual Color get_BackColor();
public: __property virtual void set_BackColor(Color);
[JScript]
public function get BackColor() : Color;
public function set BackColor(Color);

Property Value

A Color that represents the background color of the control. The default is the value of the DefaultBackColor property.

Remarks

The BackColor property does not support transparent colors unless the ControlStyles.SupportsTransparentBackColor style bit is set to true.

The BackColor property is an ambient property. An ambient property is a control property that, if not set, is retrieved from the parent control. For example, a Button will have the same BackColor as its parent Form by default. For more information about ambient properties, see the AmbientProperties class or the Control class overview.

Notes to Inheritors:  When overriding the BackColor property in a derived class, use the base class's BackColor property to extend the base implementation. Otherwise, you must provide all the implementation. You are not required to override both the get and set accessors of the BackColor property; you can override only one if needed.

.NET Compact Framework Platform Note:  Version 1.0 of the .NET Compact Framework provides support for the BackColor property (inherited from the base Control class) for the following controls: Control, System.Windows.Forms.DataGrid, Form, Panel, TabPage, and TextBox.

The BackColor for CheckBox, Label, PictureBox, RadioButton, and TrackBar is transparent by default.

In addition, the .NET Compact Framework Service Pack 2 provides BackColor support for the following controls: Button, CheckBox, ComboBox, System.Windows.Forms.DomanUpDown, Label, ListBox, ListView, NumericUpDown, PictureBox, RadioButton, and TrackBar Service Pack 2 provides BackColor support for TreeView on Windows CE .NET devices other than Pocket PCs and Smartphones.

The Smart Devices Developer Community Web site provides information about the availability of service packs, see http://go.microsoft.com/fwlink/?LinkId=16561.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

Control Class | Control Members | System.Windows.Forms Namespace | AmbientProperties | BackColorChanged

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.