DateTimePicker.CalendarFont 属性

获取或设置应用于日历的字体样式。

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
<LocalizableAttribute(True)> _
Public Property CalendarFont As Font
用法
Dim instance As DateTimePicker
Dim value As Font

value = instance.CalendarFont

instance.CalendarFont = value
[LocalizableAttribute(true)] 
public Font CalendarFont { get; set; }
[LocalizableAttribute(true)] 
public:
property Font^ CalendarFont {
    Font^ get ();
    void set (Font^ value);
}
/** @property */
public Font get_CalendarFont ()

/** @property */
public void set_CalendarFont (Font value)
public function get CalendarFont () : Font

public function set CalendarFont (value : Font)

属性值

表示应用于日历的字体样式的 Font

示例

下面的代码示例演示如何初始化 CalendarFont 属性。本示例将创建一个新的 DateTimePicker 控件,并将其添加到 FormControls 集合中,然后将 CalendarFont 属性初始化为动态定义的 Font

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
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:
   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();
    get_Controls().AddRange(new Control[] { dateTimePicker1 });
    dateTimePicker1.set_CalendarFont(new Font("Courier New",
        8.25f, FontStyle.Italic, GraphicsUnit.Point, (ubyte)0));
} //MyClass

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0

请参见

参考

DateTimePicker 类
DateTimePicker 成员
System.Windows.Forms 命名空间