PowerTools PlusPak for Windows Forms 8.0J
NoteStyle プロパティ
使用例 

メモの外観を示す NoteStyle を取得または設定します。
構文
Public Property NoteStyle As NoteStyle
public NoteStyle NoteStyle {get; set;}

プロパティ値

メモの外観を示す NoteStyle。デフォルト値は null 参照 (Visual Basicでは Nothing) です。
解説
CalendarNote の外観は NoteStyle によって指定できます。メモは NoteStyleName を使用して GcCalendar.NoteStyles から NoteStyle を取得します。NoteStyleName が設定されていない場合、またはそのスタイル名に対応するスタイルが見つからない場合は、CalendarNote.NoteStyle が使用されます。NoteStyle がまだ設定されていない場合は、GcCalendar.DefaultNoteStyle が使用されます。
使用例

次のサンプルコードは、CalendarNoteHolidayStyle に関連付ける方法を示します。また、NoteStyle を使用してメモの外観を設定する方法も示します。

private void CreateCalendarWithNoteStyle()
{
    // Create a GcCalendar.
    GcCalendar gcCalendar1 = new GcCalendar();
    gcCalendar1.Size = new Size(500, 500);
    gcCalendar1.CalendarType = CalendarType.MonthDay;

    // Add 3 holiday styles for Sunday, Monday, and Saturday in each month.
    HolidayStyle holidayStyle1 = new HolidayStyle("holidayStyle1");
    holidayStyle1.Holidays.Add(new DayOfWeekHoliday("Sunday", MonthFlags.All, DayOfWeekInMonthFlags.All, DayOfWeekFlags.Sunday));
    HolidayStyle holidayStyle2 = new HolidayStyle("holidayStyle2");
    holidayStyle2.Holidays.Add(new DayOfWeekHoliday("Monday", MonthFlags.All, DayOfWeekInMonthFlags.All, DayOfWeekFlags.Monday));
    HolidayStyle holidayStyle3 = new HolidayStyle("holidayStyle3");
    holidayStyle3.Holidays.Add(new DayOfWeekHoliday("Saturday", MonthFlags.All, DayOfWeekInMonthFlags.All, DayOfWeekFlags.Saturday));
    gcCalendar1.HolidayStyles.Add(holidayStyle1.Name, holidayStyle1);
    gcCalendar1.HolidayStyles.Add(holidayStyle2.Name, holidayStyle2);
    gcCalendar1.HolidayStyles.Add(holidayStyle3.Name, holidayStyle3);
    gcCalendar1.ActiveHolidayStyles = new string[] { "holidayStyle1", "holidayStyle2", "holidayStyle3" };

    // Allow the notes to show in calendar.
    gcCalendar1.ShowNotes = true;

    // Set the default style for notes.
    gcCalendar1.DefaultNoteStyle.BackColor = Color.LightBlue;
    gcCalendar1.DefaultNoteStyle.ForeColor = Color.DarkBlue;

    // Create 2 named note style and add them to calendar.
    NoteStyle style1 = new NoteStyle("style1");
    style1.BackColor = Color.LightGreen;
    style1.ForeColor = Color.DarkGreen;
    NoteStyle style2 = new NoteStyle("style2");
    style2.BackColor = Color.Pink;
    style2.ForeColor = Color.Brown;
    gcCalendar1.NoteStyles.Add(style1);
    gcCalendar1.NoteStyles.Add(style2);

    // Add 3 notes for the holiday styles. The notes will display the  holiday names and use different note styles.
    gcCalendar1.Notes.Add("holidayStyle1", new CalendarNote(null, null, NoteDisplayMode.Text, "style1"), true);
    gcCalendar1.Notes.Add("holidayStyle2", new CalendarNote(null, null, NoteDisplayMode.Text, "style2"), true);
    gcCalendar1.Notes.Add("holidayStyle3", new CalendarNote(null, null, NoteDisplayMode.Text), true);

    this.Controls.Add(gcCalendar1);
}
Private Sub CreateCalendarWithNoteStyle()
    ' Create a GcCalendar.
    Dim gcCalendar1 As New GcCalendar()
    gcCalendar1.Size = New Size(500, 500)
    gcCalendar1.CalendarType = CalendarType.MonthDay

    ' Add 3 holiday styles for Sunday, Monday, and Saturday in each month.
    Dim holidayStyle1 As New HolidayStyle("holidayStyle1")
    holidayStyle1.Holidays.Add(New DayOfWeekHoliday("Sunday", MonthFlags.All, DayOfWeekInMonthFlags.All, DayOfWeekFlags.Sunday))
    Dim holidayStyle2 = New HolidayStyle("holidayStyle2")
    holidayStyle2.Holidays.Add(New DayOfWeekHoliday("Monday", MonthFlags.All, DayOfWeekInMonthFlags.All, DayOfWeekFlags.Monday))
    Dim holidayStyle3 = New HolidayStyle("holidayStyle3")
    holidayStyle3.Holidays.Add(New DayOfWeekHoliday("Saturday", MonthFlags.All, DayOfWeekInMonthFlags.All, DayOfWeekFlags.Saturday))
    gcCalendar1.HolidayStyles.Add(holidayStyle1.Name, holidayStyle1)
    gcCalendar1.HolidayStyles.Add(holidayStyle2.Name, holidayStyle2)
    gcCalendar1.HolidayStyles.Add(holidayStyle3.Name, holidayStyle3)
    gcCalendar1.ActiveHolidayStyles = New String() {"holidayStyle1", "holidayStyle2", "holidayStyle3"}

    ' Allow the notes to show in calendar.
    gcCalendar1.ShowNotes = True

    ' Set the default style for notes.
    gcCalendar1.DefaultNoteStyle.BackColor = Color.LightBlue
    gcCalendar1.DefaultNoteStyle.ForeColor = Color.DarkBlue

    ' Create 2 named note style and add them to calendar.
    Dim style1 = New NoteStyle("style1")
    style1.BackColor = Color.LightGreen
    style1.ForeColor = Color.DarkGreen
    Dim style2 = New NoteStyle("style2")
    style2.BackColor = Color.Pink
    style2.ForeColor = Color.Brown
    gcCalendar1.NoteStyles.Add(style1)
    gcCalendar1.NoteStyles.Add(style2)

    ' Add 3 notes for the holiday styles. The notes will display the  holiday names and use different note styles.
    gcCalendar1.Notes.Add("holidayStyle1", New CalendarNote(Nothing, Nothing, NoteDisplayMode.Text, "style1"), True)
    gcCalendar1.Notes.Add("holidayStyle2", New CalendarNote(Nothing, Nothing, NoteDisplayMode.Text, "style2"), True)
    gcCalendar1.Notes.Add("holidayStyle3", New CalendarNote(Nothing, Nothing, NoteDisplayMode.Text), True)

    Me.Controls.Add(gcCalendar1)
End Sub
プラットフォーム

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

参照

CalendarNote クラス
CalendarNote メンバ

Send Feedback