DateTimePicker.CalendarFont Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the font style applied to the calendar.
public:
property System::Drawing::Font ^ CalendarFont { System::Drawing::Font ^ get(); void set(System::Drawing::Font ^ value); };
public System.Drawing.Font CalendarFont { get; set; }
member this.CalendarFont : System.Drawing.Font with get, set
Public Property CalendarFont As Font
Property Value
A Font that represents the font style applied to the calendar.
Examples
The following code 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.
public:
MyClass()
{
// Create a new DateTimePicker.
DateTimePicker^ dateTimePicker1 = gcnew DateTimePicker;
array<Control^>^ myClassControls = {dateTimePicker1};
Controls->AddRange( myClassControls );
dateTimePicker1->CalendarFont = gcnew System::Drawing::Font(
"Courier New", 8.25F, FontStyle::Italic, GraphicsUnit::Point, ((Byte)(0)) );
}
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)));
}
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
Remarks
Starting with Windows Vista and depending on the theme, setting this property might not change the appearance of the calendar. For example, if Windows is set to use the Aero theme, setting this property has no effect. This is because an updated version of the calendar is rendered with an appearance that is derived at run time from the current operating system theme. If you want to use this property and enable the earlier version of the calendar, you can disable visual styles for your application. Disabling visual styles might affect the appearance and behavior of other controls in your application. To disable visual styles in Visual Basic, open the Project Designer and uncheck the Enable XP visual styles check box. To disable visual styles in C#, open Program.cs and comment out Application.EnableVisualStyles();
.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기