Windows Forms MonthCalendar 컨트롤은 일(일)을 단수 날짜 또는 반복 단위로 굵게 표시할 수 있습니다. 이 작업을 수행하여 휴일 및 주말과 같은 특별한 날짜에 주의를 끌 수 있습니다.
세 가지 속성이 이 기능을 제어합니다. BoldedDates 속성에는 단일 날짜가 포함됩니다. AnnuallyBoldedDates 속성에는 매년 굵게 표시되는 날짜가 포함되어 있습니다. MonthlyBoldedDates 속성에는 매년 굵게 표시되는 날짜가 포함되어 있습니다. 이러한 각 속성에는 DateTime 개체의 배열이 포함됩니다. 이러한 목록 중 하나에서 날짜를 추가하거나 제거하려면 DateTime 개체를 추가하거나 제거해야 합니다.
날짜를 굵게 표시하려면
DateTime 개체를 만듭니다.
Dim myVacation1 As Date = New DateTime(2001, 6, 10) Dim myVacation2 As Date = New DateTime(2001, 6, 17)DateTime myVacation1 = new DateTime(2001, 6, 10); DateTime myVacation2 = new DateTime(2001, 6, 17);DateTime myVacation1 = DateTime(2001, 6, 10); DateTime myVacation2 = DateTime(2001, 6, 17);MonthCalendar 컨트롤의 AddBoldedDate, AddAnnuallyBoldedDate 또는 AddMonthlyBoldedDate 메서드를 호출하여 단일 날짜를 굵게 만듭니다.
MonthCalendar1.AddBoldedDate(myVacation1) MonthCalendar1.AddBoldedDate(myVacation2)monthCalendar1.AddBoldedDate(myVacation1); monthCalendar1.AddBoldedDate(myVacation2);monthCalendar1->AddBoldedDate(myVacation1); monthCalendar1->AddBoldedDate(myVacation2);–또는–
DateTime 개체 배열을 만들고 속성 중 하나에 할당하여 날짜 집합을 한 번에 굵게 표시합니다.
Dim VacationDates As DateTime() = {myVacation1, myVacation2} MonthCalendar1.BoldedDates = VacationDatesDateTime[] VacationDates = {myVacation1, myVacation2}; monthCalendar1.BoldedDates = VacationDates;Array<DateTime>^ VacationDates = {myVacation1, myVacation2}; monthCalendar1->BoldedDates = VacationDates;
날짜를 일반 글꼴로 표시하려면
RemoveBoldedDate, RemoveAnnuallyBoldedDate 또는 RemoveMonthlyBoldedDate 메서드를 호출하여 굵게 표시된 단일 날짜를 일반 글꼴에 표시합니다.
MonthCalendar1.RemoveBoldedDate(myVacation1) MonthCalendar1.RemoveBoldedDate(myVacation2)monthCalendar1.RemoveBoldedDate(myVacation1); monthCalendar1.RemoveBoldedDate(myVacation2);monthCalendar1->RemoveBoldedDate(myVacation1); monthCalendar1->RemoveBoldedDate(myVacation2);–또는–
RemoveAllBoldedDates, RemoveAllAnnuallyBoldedDates 또는 RemoveAllMonthlyBoldedDates 메서드를 호출하여 세 목록 중 하나에서 굵게 표시된 날짜를 모두 제거합니다.
MonthCalendar1.RemoveAllBoldedDates()monthCalendar1.RemoveAllBoldedDates();monthCalendar1->RemoveAllBoldedDates();UpdateBoldedDates 메서드를 호출하여 글꼴의 모양을 업데이트합니다.
MonthCalendar1.UpdateBoldedDates()monthCalendar1.UpdateBoldedDates();monthCalendar1->UpdateBoldedDates();
참고하십시오
.NET Desktop feedback