MESCIUS SPREAD for Windows Forms 15.0J
ActiveHolidayStyles プロパティ (DropDownCalendar)
使用例 

ドロップダウンカレンダーのアクティブな休日スタイルを取得または設定します。
構文
'宣言
 
Public Property ActiveHolidayStyles As String()
public string[] ActiveHolidayStyles {get; set;}

プロパティ値

アクティブな休日スタイルを示す System.String の配列。
解説
DropDownCalendarの休日スタイルは、同じ外観を持つ休日のグループです。DropDownCalendarには複数の異なるHolidayStyle定義を含めることができますが、ActiveHolidayStylesプロパティで設定された休日名スタイルのみが表示されます。
使用例
次のサンプルコードは、特定の日のスタイルを設定します。
var gcDateTimeCell1 = new GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType();
GrapeCity.Win.Spread.InputMan.CellType.HolidayStyle nationalHoliday = new GrapeCity.Win.Spread.InputMan.CellType.HolidayStyle("US National Holiday");
nationalHoliday.SubStyle = new GrapeCity.Win.Spread.InputMan.CellType.SubStyle(Color.Purple, Color.White, true, true);
nationalHoliday.Holidays.Add((GrapeCity.Win.Spread.InputMan.CellType.IHoliday)new GrapeCity.Win.Spread.InputMan.CellType.Holiday("New Years Day", 1, 1));
nationalHoliday.Holidays.Add((GrapeCity.Win.Spread.InputMan.CellType.IHoliday)new GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekHoliday("Martin Luther King Day", GrapeCity.Win.Spread.InputMan.CellType.MonthFlags.January, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekInMonthFlags.Third, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekFlags.Monday));
nationalHoliday.Holidays.Add((GrapeCity.Win.Spread.InputMan.CellType.IHoliday)new GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekHoliday("Memorial Day", GrapeCity.Win.Spread.InputMan.CellType.MonthFlags.May, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekInMonthFlags.Last, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekFlags.Monday));
nationalHoliday.Holidays.Add((GrapeCity.Win.Spread.InputMan.CellType.IHoliday)new GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekHoliday("Labor Day", GrapeCity.Win.Spread.InputMan.CellType.MonthFlags.September, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekInMonthFlags.First, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekFlags.Monday));
nationalHoliday.Holidays.Add((GrapeCity.Win.Spread.InputMan.CellType.IHoliday)new GrapeCity.Win.Spread.InputMan.CellType.Holiday("Christmas Day", 12, 25));

GrapeCity.Win.Spread.InputMan.CellType.HolidayStyle nonePublicHoliday = new GrapeCity.Win.Spread.InputMan.CellType.HolidayStyle("None Public Holiday");
nonePublicHoliday.SubStyle = new GrapeCity.Win.Spread.InputMan.CellType.SubStyle(Color.White, Color.Red, true, false);
nonePublicHoliday.Holidays.Add((GrapeCity.Win.Spread.InputMan.CellType.IHoliday)new GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekHoliday("Mothers Day", GrapeCity.Win.Spread.InputMan.CellType.MonthFlags.May, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekInMonthFlags.Second, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekFlags.Sunday));
nonePublicHoliday.Holidays.Add((GrapeCity.Win.Spread.InputMan.CellType.IHoliday)new GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekHoliday("Fathers Day", GrapeCity.Win.Spread.InputMan.CellType.MonthFlags.June, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekInMonthFlags.Third, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekFlags.Sunday));

gcDateTimeCell1.DropDownCalendar.HolidayStyles.Add("PublicHoliday", nationalHoliday);
gcDateTimeCell1.DropDownCalendar.HolidayStyles.Add("OtherHoliday", nonePublicHoliday);
gcDateTimeCell1.DropDownCalendar.ActiveHolidayStyles = new string[] { "PublicHoliday" };
fpSpread1.Sheets[0].Cells[1, 1].CellType = gcDateTimeCell1;
Dim gcDateTimeCell1 As New GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType()
Dim nationalHoliday As New GrapeCity.Win.Spread.InputMan.CellType.HolidayStyle("US National Holiday")
nationalHoliday.SubStyle = New GrapeCity.Win.Spread.InputMan.CellType.SubStyle(Color.Purple, Color.White, True, True)
nationalHoliday.Holidays.Add(DirectCast(New GrapeCity.Win.Spread.InputMan.CellType.Holiday("New Years Day", 1, 1), GrapeCity.Win.Spread.InputMan.CellType.IHoliday))
nationalHoliday.Holidays.Add(DirectCast(New GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekHoliday("Martin Luther King Day", GrapeCity.Win.Spread.InputMan.CellType.MonthFlags.January, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekInMonthFlags.Third, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekFlags.Monday), GrapeCity.Win.Spread.InputMan.CellType.IHoliday))
nationalHoliday.Holidays.Add(DirectCast(New GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekHoliday("Memorial Day", GrapeCity.Win.Spread.InputMan.CellType.MonthFlags.May, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekInMonthFlags.Last, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekFlags.Monday), GrapeCity.Win.Spread.InputMan.CellType.IHoliday))
nationalHoliday.Holidays.Add(DirectCast(New GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekHoliday("Labor Day", GrapeCity.Win.Spread.InputMan.CellType.MonthFlags.September, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekInMonthFlags.First, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekFlags.Monday), GrapeCity.Win.Spread.InputMan.CellType.IHoliday))
nationalHoliday.Holidays.Add(DirectCast(New GrapeCity.Win.Spread.InputMan.CellType.Holiday("Christmas Day", 12, 25), GrapeCity.Win.Spread.InputMan.CellType.IHoliday))

Dim nonePublicHoliday As New GrapeCity.Win.Spread.InputMan.CellType.HolidayStyle("None Public Holiday")
nonePublicHoliday.SubStyle = New GrapeCity.Win.Spread.InputMan.CellType.SubStyle(Color.White, Color.Red, True, False)
nonePublicHoliday.Holidays.Add(DirectCast(New GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekHoliday("Mothers Day", GrapeCity.Win.Spread.InputMan.CellType.MonthFlags.May, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekInMonthFlags.Second, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekFlags.Sunday), GrapeCity.Win.Spread.InputMan.CellType.IHoliday))
nonePublicHoliday.Holidays.Add(DirectCast(New GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekHoliday("Fathers Day", GrapeCity.Win.Spread.InputMan.CellType.MonthFlags.June, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekInMonthFlags.Third, GrapeCity.Win.Spread.InputMan.CellType.DayOfWeekFlags.Sunday), GrapeCity.Win.Spread.InputMan.CellType.IHoliday))

gcDateTimeCell1.DropDownCalendar.HolidayStyles.Add("PublicHoliday", nationalHoliday)
gcDateTimeCell1.DropDownCalendar.HolidayStyles.Add("OtherHoliday", nonePublicHoliday)
gcDateTimeCell1.DropDownCalendar.ActiveHolidayStyles = New String() {"PublicHoliday"}
fpSpread1.Sheets(0).Cells(1, 1).CellType = gcDateTimeCell1
参照

DropDownCalendar クラス
DropDownCalendar メンバ

 

 


© MESCIUS inc. All rights reserved.