GrapeCity CalendarGrid for Windows Forms 3.0J
カレンダーのヘッダを追加する

CalendarGridのヘッダは、既定では月スタイルのカレンダーに最適化されています。週スタイルのカレンダーにヘッダを追加するには、次のようにはじめに既存の項目を削除し、その後に週スタイルのためのボタンやキャプションを追加します。

Imports GrapeCity.Win.CalendarGrid

Dim weekView As New CalendarWeekView()
GcCalendarGrid1.CalendarView = weekView

GcCalendarGrid1.TitleHeader.Children.Clear()

Dim prevWeekButton As New CalendarTitleButton()
prevWeekButton.ButtonBehavior = CalendarTitleButtonBehavior.Previous
prevWeekButton.ScrollUnit = CalendarScrollUnit.Week
prevWeekButton.ScrollUnitCount = 1
prevWeekButton.Text = "<<"
GcCalendarGrid1.TitleHeader.Children.Add(prevWeekButton)

Dim nextWeekButton As New CalendarTitleButton()
nextWeekButton.ButtonBehavior = CalendarTitleButtonBehavior.Next
nextWeekButton.ScrollUnit = CalendarScrollUnit.Week
nextWeekButton.ScrollUnitCount = 1
nextWeekButton.Text = ">>"
GcCalendarGrid1.TitleHeader.Children.Add(nextWeekButton)

Dim titleCaption As New CalendarTitleCaption()
titleCaption.DateFormatType = CalendarDateFormatType.InputMan
titleCaption.DateFormat = "gggee年(yyyy年)M月d日"
titleCaption.Text = "{0} から {1} まで"
GcCalendarGrid1.TitleHeader.Children.Add(titleCaption)
using GrapeCity.Win.CalendarGrid;

CalendarWeekView weekView = new CalendarWeekView();
gcCalendarGrid1.CalendarView = weekView;

gcCalendarGrid1.TitleHeader.Children.Clear();

CalendarTitleButton prevWeekButton = new CalendarTitleButton();
prevWeekButton.ButtonBehavior = CalendarTitleButtonBehavior.Previous;
prevWeekButton.ScrollUnit = CalendarScrollUnit.Week;
prevWeekButton.ScrollUnitCount = 1;
prevWeekButton.Text = "<<";
gcCalendarGrid1.TitleHeader.Children.Add(prevWeekButton);

CalendarTitleButton nextWeekButton = new CalendarTitleButton();
nextWeekButton.ButtonBehavior = CalendarTitleButtonBehavior.Next;
nextWeekButton.ScrollUnit = CalendarScrollUnit.Week;
nextWeekButton.ScrollUnitCount = 1;
nextWeekButton.Text = ">>";
gcCalendarGrid1.TitleHeader.Children.Add(nextWeekButton);

CalendarTitleCaption titleCaption = new CalendarTitleCaption();
titleCaption.DateFormatType = CalendarDateFormatType.InputMan;
titleCaption.DateFormat = "gggee年(yyyy年)M月d日";
titleCaption.Text = "{0} から {1} まで";
gcCalendarGrid1.TitleHeader.Children.Add(titleCaption);

結果は次のようになります。

関連トピック

 

 


© 2008 GrapeCity inc. All rights reserved.