PowerTools CalendarGrid for Windows Forms 1.0J
CalendarHoliday クラス
メンバ  使用例 

GcCalendarGrid コントロールの休日を表します。
構文
Public Class CalendarHoliday 
public class CalendarHoliday 
解説
休日は GcCalendarGrid.Holidays コレクションに追加できます。休日の外観をカスタマイズするには、CalendarConditionalCellStyleConditionalStyleOperator.IsHoliday 演算子を使用します。
使用例
次のサンプルコードは、GcCalendarGrid に休日を追加する方法を示します。
private void AddHolidays()
{
    CalendarCellStyle holidayStyle = new CalendarCellStyle();
    holidayStyle.BackColor = Color.LightBlue;
    holidayStyle.ForeColor = Color.DarkGreen;
    CalendarConditionalCellStyle conditionalStyle = new CalendarConditionalCellStyle("style1");
    conditionalStyle.Items.Add(new CalendarConditionalCellStyleItem(holidayStyle, ConditionalStyleOperator.IsHoliday));
    this.gcCalendarGrid1.Styles.Add(conditionalStyle);
    
    this.gcCalendarGrid1.Template.Content[1, 0].DateFormat = CalendarDateFormats.HolidayName;
    this.gcCalendarGrid1.Template.Content[1, 0].CellStyleName = "style1";

    // Add Japanese holidays from 2014-1-1 to 2015-12-31.
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2014, 1, 1),     "New Year's Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2014, 1, 13),    "Coming of Age Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2014, 2, 11),    "National Foundation Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2014, 3, 21),    "Vernal Equinox Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2014, 4, 29),    "Showa Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2014, 5, 3),     "Constitution Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2014, 5, 4),     "Greenery Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2014, 5, 5),     "Children's Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2014, 5, 6),     "Greenery Day (Observed)");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2014, 7, 21),    "Marine Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2014, 9, 15),    "Respect for the Aged Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2014, 9, 23),    "Autumnal Equinox Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2014, 10, 13),   "Health Sport's Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2014, 11, 3),    "Culture Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2014, 11, 23),   "Labor Thanksgiving Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2014, 11, 24),   "Labor Thanksgiving Day (Observed)");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2014, 12, 23),   "Emperor's Birthday");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2014, 12, 31),   "New Year's Eve");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2015, 1, 1),     "New Year's Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2015, 1, 12),    "Coming of Age Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2015, 2, 11),    "National Foundation Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2015, 3, 21),    "Vernal Equinox Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2015, 4, 29),    "Showa Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2015, 5, 3),     "Constitution Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2015, 5, 4),     "Greenery Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2015, 5, 5),     "Children's Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2015, 5, 6),     "Constitution Day (Observed)");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2015, 7, 20),    "Marine Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2015, 9, 21),    "Respect for the Aged Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2015, 9, 22),    "People's Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2015, 9, 23),    "Autumnal Equinox Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2015, 10, 12),   "Health Sport's Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2015, 11, 3),    "Culture Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2015, 11, 23),   "Labor Thanksgiving Day");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2015, 12, 23),   "Emperor's Birthday");
    this.gcCalendarGrid1.Holidays.Add(new DateTime(2015, 12, 31),   "New Year's Eve");
}
Private Sub AddHolidays()
    Dim holidayStyle As New CalendarCellStyle()
    holidayStyle.BackColor = Color.LightBlue
    holidayStyle.ForeColor = Color.DarkGreen
    Dim conditionalStyle As New CalendarConditionalCellStyle("style1")
    conditionalStyle.Items.Add(New CalendarConditionalCellStyleItem(holidayStyle, ConditionalStyleOperator.IsHoliday))
    Me.gcCalendarGrid1.Styles.Add(conditionalStyle)

    Me.gcCalendarGrid1.Template.Content(1, 0).DateFormat = CalendarDateFormats.HolidayName
    Me.gcCalendarGrid1.Template.Content(1, 0).CellStyleName = "style1"

    ' Add Japanese holidays from 2014-1-1 to 2015-12-31.
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2014, 1, 1), "New Year's Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2014, 1, 13), "Coming of Age Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2014, 2, 11), "National Foundation Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2014, 3, 21), "Vernal Equinox Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2014, 4, 29), "Showa Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2014, 5, 3), "Constitution Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2014, 5, 4), "Greenery Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2014, 5, 5), "Children's Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2014, 5, 6), "Greenery Day (Observed)")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2014, 7, 21), "Marine Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2014, 9, 15), "Respect for the Aged Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2014, 9, 23), "Autumnal Equinox Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2014, 10, 13), "Health Sport's Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2014, 11, 3), "Culture Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2014, 11, 23), "Labor Thanksgiving Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2014, 11, 24), "Labor Thanksgiving Day (Observed)")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2014, 12, 23), "Emperor's Birthday")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2014, 12, 31), "New Year's Eve")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2015, 1, 1), "New Year's Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2015, 1, 12), "Coming of Age Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2015, 2, 11), "National Foundation Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2015, 3, 21), "Vernal Equinox Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2015, 4, 29), "Showa Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2015, 5, 3), "Constitution Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2015, 5, 4), "Greenery Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2015, 5, 5), "Children's Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2015, 5, 6), "Constitution Day (Observed)")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2015, 7, 20), "Marine Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2015, 9, 21), "Respect for the Aged Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2015, 9, 22), "People's Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2015, 9, 23), "Autumnal Equinox Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2015, 10, 12), "Health Sport's Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2015, 11, 3), "Culture Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2015, 11, 23), "Labor Thanksgiving Day")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2015, 12, 23), "Emperor's Birthday")
    Me.gcCalendarGrid1.Holidays.Add(New DateTime(2015, 12, 31), "New Year's Eve")
End Sub
継承階層

System.Object
   GrapeCity.Win.CalendarGrid.CalendarHoliday

参照

CalendarHoliday メンバ
GrapeCity.Win.CalendarGrid 名前空間

 

 


© 2014 GrapeCity inc. All rights reserved.