Export (0) Print
Expand All

DateTimePicker.CalendarFont Property

Gets or sets the font style applied to the calendar.

[Visual Basic]
Public Property CalendarFont As Font
[C#]
public Font CalendarFont {get; set;}
[C++]
public: __property Font* get_CalendarFont();
public: __property void set_CalendarFont(Font*);
[JScript]
public function get CalendarFont() : Font;
public function set CalendarFont(Font);

Property Value

A Font that represents the font style applied to the calendar.

Example

[Visual Basic, C#, C++] The following example demonstrates how to initialize the CalendarFont property. This example creates a new DateTimePicker control, adds it to the Controls collection of a Form, and then initializes the CalendarFont property to a dynamically defined Font.

[Visual Basic] 
Public Sub New()
   ' Create a new DateTimePicker.
   Dim dateTimePicker1 As New DateTimePicker()
   Controls.AddRange(New Control() {dateTimePicker1})
   dateTimePicker1.CalendarFont = New Font("Courier New", 8.25F, FontStyle.Italic, GraphicsUnit.Point, CType(0, [Byte]))
End Sub

[C#] 
public MyClass()
{
   // Create a new DateTimePicker.
   DateTimePicker dateTimePicker1 = new DateTimePicker();
   Controls.AddRange(new Control[] {dateTimePicker1}); 
   dateTimePicker1.CalendarFont = new Font("Courier New", 8.25F, FontStyle.Italic, GraphicsUnit.Point, ((Byte)(0)));
}

[C++] 
public:
    MyClass() {
        // Create a new DateTimePicker.
        DateTimePicker* dateTimePicker1 = new DateTimePicker();
        Control* myClassControls[] = {dateTimePicker1};
        Controls->AddRange(myClassControls);
        dateTimePicker1->CalendarFont = new System::Drawing::Font(S"Courier New",
            8.25F, FontStyle::Italic, GraphicsUnit::Point, ((Byte)(0)));
    }

[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

Show:
© 2014 Microsoft