Spread Windows Forms 9.0 Product Documentation
HolidayStyles Property (DropDownCalendar)
Example 


Gets or sets holiday styles.
Syntax
'Declaration
 
Public Property HolidayStyles As HolidayStyleCollection
'Usage
 
Dim instance As DropDownCalendar
Dim value As HolidayStyleCollection
 
instance.HolidayStyles = value
 
value = instance.HolidayStyles
public HolidayStyleCollection HolidayStyles {get; set;}

Property Value

A HolidayStyleCollection object that indicates the holiday style collection.
Remarks
A holiday style in DropDownCalendar is a group of holidays with the same appearance. DropDownCalendar can have several different HolidayStyle definitions, but only the holiday name style set with the ActiveHolidayStyles property is displayed.
Example
This example creates styles to use for certain days.
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
Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows Server 2012 R2, Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10

See Also

Reference

DropDownCalendar Class
DropDownCalendar Members

 

 


Copyright © GrapeCity, inc. All rights reserved.