Export (0) Print
Expand All
Expand Minimize

Control.ForeColor Property

Gets or sets the foreground color of the control.

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

Property Value

The foreground Color of the control. The default is the value of the DefaultForeColor property.

Remarks

The ForeColor 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 ForeColor property in a derived class, use the base class's ForeColor 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 ForeColor 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 ForeColor property (inherited from the base Control class) for the following controls: Control, System.Windows.Forms.DataGrid, Label, and TextBox.

In addition, the .NET Compact Framework Service Pack 2 provides ForeColor support for the following controls: Button, CheckBox, ComboBox, DomainUpDown, ListBox, ListView, NumericUpDown, RadioButton, and TreeView.

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 | ForeColorChanged | OnForeColorChanged | Color

Show:
© 2015 Microsoft