DateTimePicker.CalendarMonthBackground 属性

获取或设置历月的背景色。

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

语法

声明
Public Property CalendarMonthBackground As Color
用法
Dim instance As DateTimePicker
Dim value As Color

value = instance.CalendarMonthBackground

instance.CalendarMonthBackground = value
public Color CalendarMonthBackground { get; set; }
public:
property Color CalendarMonthBackground {
    Color get ();
    void set (Color value);
}
/** @property */
public Color get_CalendarMonthBackground ()

/** @property */
public void set_CalendarMonthBackground (Color value)
public function get CalendarMonthBackground () : Color

public function set CalendarMonthBackground (value : Color)

属性值

表示历月背景色的 Color

异常

异常类型 条件

ArgumentException

分配的值为 空引用(在 Visual Basic 中为 Nothing)。

备注

创建 DateTimePicker 后,此属性最初设置为等于 DefaultMonthBackColor 字段的值。

示例

下面的代码示例演示如何初始化 CalendarMonthBackground 属性。创建 DateTimePicker 并将其添加到 Form 后,该示例将 CalendarMonthBackground 属性初始化为 Color 常数。

Public Sub New()
   Dim dateTimePicker1 As New DateTimePicker()
   Controls.AddRange(New Control() {dateTimePicker1})
   dateTimePicker1.CalendarMonthBackground = Color.Aqua
End Sub 
public MyClass()
{
   DateTimePicker dateTimePicker1 = new DateTimePicker();
   Controls.AddRange(new Control[] {dateTimePicker1}); 
   dateTimePicker1.CalendarMonthBackground = Color.Aqua;
}
public:
   MyClass()
   {
      DateTimePicker^ dateTimePicker1 = gcnew DateTimePicker;
      array<Control^>^ myClassControls = {dateTimePicker1};
      Controls->AddRange( myClassControls );
      dateTimePicker1->CalendarMonthBackground = Color::Aqua;
   }
public MyClass()
{
    DateTimePicker dateTimePicker1 = new DateTimePicker();
    get_Controls().AddRange(new Control[] { dateTimePicker1 });
    dateTimePicker1.set_CalendarMonthBackground(Color.get_Aqua());
} //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

请参见

参考

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