Export (0) Print
Expand All

DateTimePicker.CalendarForeColor Property

Gets or sets the foreground color of the calendar.

[Visual Basic]
Public Property CalendarForeColor As Color
[C#]
public Color CalendarForeColor {get; set;}
[C++]
public: __property Color get_CalendarForeColor();
public: __property void set_CalendarForeColor(Color);
[JScript]
public function get CalendarForeColor() : Color;
public function set CalendarForeColor(Color);

Property Value

A Color that represents the foreground color of the calendar.

Exceptions

Exception Type Condition
ArgumentException The value assigned is a null reference (Nothing in Visual Basic).

Remarks

When a DateTimePicker is created, this property is initially set equal to the ForeColor property value.

Example

[Visual Basic, C#, C++] The following example demonstrates how to initialize the CalendarForeColor property. This example creates a new DateTimePicker, adds it to the Controls collection, and then initializes its CalendarForeColor property to the Aqua constant.

[Visual Basic] 
Public Sub New()
   Dim dateTimePicker1 As New DateTimePicker()
   Controls.AddRange(New Control() {dateTimePicker1})
   dateTimePicker1.CalendarForeColor = Color.Aqua
End Sub 

[C#] 
public MyClass()
{
   DateTimePicker dateTimePicker1 = new DateTimePicker();
   Controls.AddRange(new Control[] {dateTimePicker1}); 
   dateTimePicker1.CalendarForeColor = Color.Aqua;
}

[C++] 
public:
    MyClass() {
        DateTimePicker* dateTimePicker1 = new DateTimePicker();
        Control* myClassControls[] = {dateTimePicker1};
        Controls->AddRange(myClassControls); 
        dateTimePicker1->CalendarForeColor = Color::Aqua;
    }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

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

See Also

DateTimePicker Class | DateTimePicker Members | System.Windows.Forms Namespace | ForeColor

Show:
© 2014 Microsoft