MonthCalendar.TitleForeColor 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
달력의 제목 영역에 사용하는 전경색을 나타내는 값을 가져오거나 설정합니다.
public:
property System::Drawing::Color TitleForeColor { System::Drawing::Color get(); void set(System::Drawing::Color value); };
public System.Drawing.Color TitleForeColor { get; set; }
member this.TitleForeColor : System.Drawing.Color with get, set
Public Property TitleForeColor As Color
속성 값
Color 활성 캡션 텍스트에 대한 시스템 색이 기본값으로 사용됩니다.
예외
값이 올바른 Color이 아닌 경우
예제
다음 코드 예제에서는 1 년을 표시 하는 컨트롤을 MonthCalendar 포함 하는 폼을 표시 합니다. 이 예제에서는 , , ForeColor, TitleBackColor, TitleForeColorCalendarDimensions및 TrailingForeColor 속성을 설정BackColor하여 달력 컨트롤의 모양을 사용자 지정하는 방법을 보여 줍니다. , 및 BoldedDatesMonthlyBoldedDates 같은 AnnuallyBoldedDates다른 속성은 굵게 표시되는 날짜를 사용자 지정하도록 설정됩니다. 이 예제에서는 , , MaxDateMinDate및 MaxSelectionCount 속성을 설정FirstDayOfWeek하여 달력 형식을 변경합니다. DateSelected 및 DateChanged 이벤트도 처리되고 해당 상태 양식에 표시됩니다.
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::Windows::Forms;
public ref class Form1: public System::Windows::Forms::Form
{
private:
System::Windows::Forms::MonthCalendar^ monthCalendar1;
System::Windows::Forms::TextBox^ textBox1;
public:
Form1()
{
this->textBox1 = gcnew System::Windows::Forms::TextBox;
this->textBox1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle;
this->textBox1->Location = System::Drawing::Point( 48, 488 );
this->textBox1->Multiline = true;
this->textBox1->ReadOnly = true;
this->textBox1->Size = System::Drawing::Size( 824, 32 );
// Create the calendar.
this->monthCalendar1 = gcnew System::Windows::Forms::MonthCalendar;
// Set the calendar location.
this->monthCalendar1->Location = System::Drawing::Point( 47, 16 );
// Change the color.
this->monthCalendar1->BackColor = System::Drawing::SystemColors::Info;
this->monthCalendar1->ForeColor = System::Drawing::Color::FromArgb( ((System::Byte)(192)) ),((System::Byte)(0)),((System::Byte)(192));
this->monthCalendar1->TitleBackColor = System::Drawing::Color::Purple;
this->monthCalendar1->TitleForeColor = System::Drawing::Color::Yellow;
this->monthCalendar1->TrailingForeColor = System::Drawing::Color::FromArgb( ((System::Byte)(192)) ),((System::Byte)(192)),((System::Byte)(0));
// Add dates to the AnnuallyBoldedDates array.
array<System::DateTime>^ temp1 = {System::DateTime( 2002, 4, 20, 0, 0, 0, 0 ),System::DateTime( 2002, 4, 28, 0, 0, 0, 0 ),System::DateTime( 2002, 5, 5, 0, 0, 0, 0 ),System::DateTime( 2002, 7, 4, 0, 0, 0, 0 ),System::DateTime( 2002, 12, 15, 0, 0, 0, 0 ),System::DateTime( 2002, 12, 18, 0, 0, 0, 0 )};
this->monthCalendar1->AnnuallyBoldedDates = temp1;
// Add dates to BoldedDates array.
array<System::DateTime>^ temp2 = {System::DateTime( 2002, 9, 26, 0, 0, 0, 0 )};
this->monthCalendar1->BoldedDates = temp2;
// Add dates to MonthlyBoldedDates array.
array<System::DateTime>^ temp5 = {System::DateTime( 2002, 1, 15, 0, 0, 0, 0 ),System::DateTime( 2002, 1, 30, 0, 0, 0, 0 )};
this->monthCalendar1->MonthlyBoldedDates = temp5;
// Configure the calendar to display 3 rows by 4 columns of months.
this->monthCalendar1->CalendarDimensions = System::Drawing::Size( 4, 3 );
// Set week to begin on Monday.
this->monthCalendar1->FirstDayOfWeek = System::Windows::Forms::Day::Monday;
// Set the maximum visible date on the calendar to 12/31/2010.
this->monthCalendar1->MaxDate = System::DateTime( 2010, 12, 31, 0, 0, 0, 0 );
// Set the minimum visible date on calendar to 12/31/2010.
this->monthCalendar1->MinDate = System::DateTime( 1999, 1, 1, 0, 0, 0, 0 );
// Only allow 21 days to be selected at the same time.
this->monthCalendar1->MaxSelectionCount = 21;
// Set the calendar to move one month at a time when navigating using the arrows.
this->monthCalendar1->ScrollChange = 1;
// Do not show the S"Today" banner.
this->monthCalendar1->ShowToday = false;
// Do not circle today's date.
this->monthCalendar1->ShowTodayCircle = false;
// Show the week numbers to the left of each week.
this->monthCalendar1->ShowWeekNumbers = true;
// Add event handlers for the DateSelected and DateChanged events
this->monthCalendar1->DateSelected += gcnew System::Windows::Forms::DateRangeEventHandler( this, &Form1::monthCalendar1_DateSelected );
this->monthCalendar1->DateChanged += gcnew System::Windows::Forms::DateRangeEventHandler( this, &Form1::monthCalendar1_DateChanged );
// Set up how the form should be displayed and add the controls to the form.
this->ClientSize = System::Drawing::Size( 920, 566 );
array<System::Windows::Forms::Control^>^temp0 = {this->textBox1,this->monthCalendar1};
this->Controls->AddRange( temp0 );
this->Text = "Month Calendar Example";
}
private:
void monthCalendar1_DateSelected( Object^ /*sender*/, System::Windows::Forms::DateRangeEventArgs^ e )
{
// Show the start and end dates in the text box.
this->textBox1->Text = String::Format( "Date Selected: Start = {0} : End = {1}", e->Start.ToShortDateString(), e->End.ToShortDateString() );
}
void monthCalendar1_DateChanged( Object^ /*sender*/, System::Windows::Forms::DateRangeEventArgs^ e )
{
// Show the start and end dates in the text box.
this->textBox1->Text = String::Format( "Date Changed: Start = {0} : End = {1}", e->Start.ToShortDateString(), e->End.ToShortDateString() );
}
};
[STAThread]
int main()
{
Application::Run( gcnew Form1 );
}
using System;
using System.Drawing;
using System.Windows.Forms;
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.MonthCalendar monthCalendar1;
private System.Windows.Forms.TextBox textBox1;
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
public Form1()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox1.Location = new System.Drawing.Point(48, 488);
this.textBox1.Multiline = true;
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(824, 32);
// Create the calendar.
this.monthCalendar1 = new System.Windows.Forms.MonthCalendar();
// Set the calendar location.
this.monthCalendar1.Location = new System.Drawing.Point(47, 16);
// Change the color.
this.monthCalendar1.BackColor = System.Drawing.SystemColors.Info;
this.monthCalendar1.ForeColor = System.Drawing.Color.FromArgb(
((System.Byte)(192)), ((System.Byte)(0)), ((System.Byte)(192)));
this.monthCalendar1.TitleBackColor = System.Drawing.Color.Purple;
this.monthCalendar1.TitleForeColor = System.Drawing.Color.Yellow;
this.monthCalendar1.TrailingForeColor = System.Drawing.Color.FromArgb(
((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(0)));
// Add dates to the AnnuallyBoldedDates array.
this.monthCalendar1.AnnuallyBoldedDates =
new System.DateTime[] { new System.DateTime(2002, 4, 20, 0, 0, 0, 0),
new System.DateTime(2002, 4, 28, 0, 0, 0, 0),
new System.DateTime(2002, 5, 5, 0, 0, 0, 0),
new System.DateTime(2002, 7, 4, 0, 0, 0, 0),
new System.DateTime(2002, 12, 15, 0, 0, 0, 0),
new System.DateTime(2002, 12, 18, 0, 0, 0, 0)};
// Add dates to BoldedDates array.
this.monthCalendar1.BoldedDates = new System.DateTime[] {new System.DateTime(2002, 9, 26, 0, 0, 0, 0)};
// Add dates to MonthlyBoldedDates array.
this.monthCalendar1.MonthlyBoldedDates =
new System.DateTime[] {new System.DateTime(2002, 1, 15, 0, 0, 0, 0),
new System.DateTime(2002, 1, 30, 0, 0, 0, 0)};
// Configure the calendar to display 3 rows by 4 columns of months.
this.monthCalendar1.CalendarDimensions = new System.Drawing.Size(4, 3);
// Set week to begin on Monday.
this.monthCalendar1.FirstDayOfWeek = System.Windows.Forms.Day.Monday;
// Set the maximum visible date on the calendar to 12/31/2010.
this.monthCalendar1.MaxDate = new System.DateTime(2010, 12, 31, 0, 0, 0, 0);
// Set the minimum visible date on calendar to 12/31/2010.
this.monthCalendar1.MinDate = new System.DateTime(1999, 1, 1, 0, 0, 0, 0);
// Only allow 21 days to be selected at the same time.
this.monthCalendar1.MaxSelectionCount = 21;
// Set the calendar to move one month at a time when navigating using the arrows.
this.monthCalendar1.ScrollChange = 1;
// Do not show the "Today" banner.
this.monthCalendar1.ShowToday = false;
// Do not circle today's date.
this.monthCalendar1.ShowTodayCircle = false;
// Show the week numbers to the left of each week.
this.monthCalendar1.ShowWeekNumbers = true;
// Add event handlers for the DateSelected and DateChanged events
this.monthCalendar1.DateSelected += new System.Windows.Forms.DateRangeEventHandler(this.monthCalendar1_DateSelected);
this.monthCalendar1.DateChanged += new System.Windows.Forms.DateRangeEventHandler(this.monthCalendar1_DateChanged);
// Set up how the form should be displayed and add the controls to the form.
this.ClientSize = new System.Drawing.Size(920, 566);
this.Controls.AddRange(new System.Windows.Forms.Control[] {this.textBox1, this.monthCalendar1});
this.Text = "Month Calendar Example";
}
private void monthCalendar1_DateSelected(object sender, System.Windows.Forms.DateRangeEventArgs e)
{
// Show the start and end dates in the text box.
this.textBox1.Text = "Date Selected: Start = " +
e.Start.ToShortDateString() + " : End = " + e.End.ToShortDateString();
}
private void monthCalendar1_DateChanged(object sender, System.Windows.Forms.DateRangeEventArgs e)
{
// Show the start and end dates in the text box.
this.textBox1.Text = "Date Changed: Start = " +
e.Start.ToShortDateString() + " : End = " + e.End.ToShortDateString();
}
}
Imports System.Drawing
Imports System.Windows.Forms
Public NotInheritable Class Form1
Inherits System.Windows.Forms.Form
Friend WithEvents MonthCalendar1 As System.Windows.Forms.MonthCalendar
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
<System.STAThread()> _
Public Shared Sub Main()
System.Windows.Forms.Application.Run(New Form1)
End Sub
Public Sub New()
MyBase.New()
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.TextBox1.Location = New System.Drawing.Point(48, 488)
Me.TextBox1.Multiline = True
Me.TextBox1.ReadOnly = True
Me.TextBox1.Size = New System.Drawing.Size(824, 32)
' Create the calendar.
Me.MonthCalendar1 = New System.Windows.Forms.MonthCalendar
' Set the calendar location.
Me.MonthCalendar1.Location = New System.Drawing.Point(47, 16)
' Change the color.
Me.MonthCalendar1.BackColor = System.Drawing.SystemColors.Info
Me.MonthCalendar1.ForeColor = System.Drawing.Color.FromArgb( _
CType(192, System.Byte), CType(0, System.Byte), CType(192, System.Byte))
Me.MonthCalendar1.TitleBackColor = System.Drawing.Color.Purple
Me.MonthCalendar1.TitleForeColor = System.Drawing.Color.Yellow
Me.MonthCalendar1.TrailingForeColor = System.Drawing.Color.FromArgb( _
CType(192, System.Byte), CType(192, System.Byte), CType(0, System.Byte))
' Add dates to the AnnuallyBoldedDates array.
Me.MonthCalendar1.AnnuallyBoldedDates = New System.DateTime() _
{New System.DateTime(2002, 4, 20, 0, 0, 0, 0), _
New System.DateTime(2002, 4, 28, 0, 0, 0, 0), _
New System.DateTime(2002, 5, 5, 0, 0, 0, 0), _
New System.DateTime(2002, 7, 4, 0, 0, 0, 0), _
New System.DateTime(2002, 12, 15, 0, 0, 0, 0), _
New System.DateTime(2002, 12, 18, 0, 0, 0, 0)}
' Add dates to BoldedDates array.
Me.MonthCalendar1.BoldedDates = New System.DateTime() {New System.DateTime(2002, 9, 26, 0, 0, 0, 0)}
' Add dates to MonthlyBoldedDates array.
Me.MonthCalendar1.MonthlyBoldedDates = New System.DateTime() _
{New System.DateTime(2002, 1, 15, 0, 0, 0, 0), _
New System.DateTime(2002, 1, 30, 0, 0, 0, 0)}
' Configure the calendar to display 3 rows by 4 columns of months.
Me.MonthCalendar1.CalendarDimensions = New System.Drawing.Size(4, 3)
' Set the week to begin on Monday.
Me.MonthCalendar1.FirstDayOfWeek = System.Windows.Forms.Day.Monday
' Sets the maximum visible date on the calendar to 12/31/2010.
Me.MonthCalendar1.MaxDate = New System.DateTime(2010, 12, 31, 0, 0, 0, 0)
' Set the minimum visible date on the calendar to 12/31/2010.
Me.MonthCalendar1.MinDate = New System.DateTime(1999, 1, 1, 0, 0, 0, 0)
' Only allow 21 days to be selected at the same time.
Me.MonthCalendar1.MaxSelectionCount = 21
' Set the calendar to move one month at a time when navigating using the arrows.
Me.MonthCalendar1.ScrollChange = 1
' Do not show the "Today" banner.
Me.MonthCalendar1.ShowToday = False
' Do not circle today's date.
Me.MonthCalendar1.ShowTodayCircle = False
' Show the week numbers to the left of each week.
Me.MonthCalendar1.ShowWeekNumbers = True
' Set up how the form should be displayed and add the controls to the form.
Me.ClientSize = New System.Drawing.Size(920, 566)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox1, Me.MonthCalendar1})
Me.Text = "Month Calendar Example"
End Sub
Private Sub monthCalendar1_DateSelected(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateSelected
' Show the start and end dates in the text box.
Me.TextBox1.Text = "Date Selected: Start = " + _
e.Start.ToShortDateString() + " : End = " + e.End.ToShortDateString()
End Sub
Private Sub monthCalendar1_DateChanged(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateChanged
' Show the start and end dates in the text box.
Me.TextBox1.Text = "Date Changed: Start = " + _
e.Start.ToShortDateString() + " : End = " + e.End.ToShortDateString()
End Sub
End Class
설명
Windows Vista부터 테마에 따라 이 속성을 설정해도 일정 모양이 변경되지 않을 수 있습니다. 예를 들어 Windows가 Aero 테마를 사용하도록 설정된 경우 이 속성을 설정해도 아무런 효과가 없습니다. 그 이유는 런타임에 현재 운영 체제 테마에서 파생된 모양으로 일정의 업데이트된 버전이 렌더링되기 때문입니다. 이 속성을 사용 하 고 달력의 이전 버전을 사용 하도록 설정 하려는 경우에 애플리케이션에 대 한 비주얼 스타일을 비활성화할 수 있습니다. 비주얼 스타일을 사용 하지 않도록 설정 하면 애플리케이션에서 다른 컨트롤의 동작과 모양을 달라질 수 있습니다. Visual Basic에서 시각적 스타일을 사용하지 않도록 설정하려면 프로젝트 디자이너를 열고 XP 시각적 스타일 사용 확인란의 선택을 취소합니다. C#에서 시각적 스타일을 사용하지 않도록 설정하려면 Program.cs를 열고 Application.EnableVisualStyles();
을 주석으로 처리합니다.
적용 대상
.NET