GrapeCity CalendarGrid for Windows Forms 2.0J
複数の月を表示する

既定では1ヶ月分の日だけが表示されます。複数の月を表示するには、CalendarMonthMultiColumnView.MonthCountプロパティに月数を指定します。
次のコードは日の折り返し無しで3ヶ月分の日を表示します。

Imports GrapeCity.Win.CalendarGrid

Dim template As New CalendarTemplate()
template.RowCount = 1
template.ColumnCount = 3
template.RowHeader.ColumnCount = 0
template.ColumnHeader.Columns(0).Width = 50
template.ColumnHeader.Rows(0).Cells(0).Value = "日付"
template.ColumnHeader.Columns(1).Width = 50
template.ColumnHeader.Rows(0).Cells(1).Value = "曜日"
template.ColumnHeader.Rows(0).Cells(2).Value = "メモ"

template.Content.Rows(0).Cells(0).DateFormat = "{MonthDay}"
template.Content.Rows(0).Cells(0).CellStyleName = "defaultStyle"
template.Content.Rows(0).Cells(1).DateFormat = "{DayOfWeek}"
template.Content.Rows(0).Cells(1).CellStyleName = "defaultStyle"
GcCalendarGrid1.Template = template

Dim monthMultiColumnView As New CalendarMonthMultiColumnView()
monthMultiColumnView.Orientation = Orientation.Vertical
monthMultiColumnView.ColumnBreaks = Nothing
monthMultiColumnView.MonthCount = 3
GcCalendarGrid1.CalendarView = monthMultiColumnView
using GrapeCity.Win.CalendarGrid;

var template = new CalendarTemplate();
template.RowCount = 1;
template.ColumnCount = 3;
template.RowHeader.ColumnCount = 0;
template.ColumnHeader.Columns[0].Width = 50;
template.ColumnHeader.Rows[0].Cells[0].Value = "日付";
template.ColumnHeader.Columns[1].Width = 50;
template.ColumnHeader.Rows[0].Cells[1].Value = "曜日";
template.ColumnHeader.Rows[0].Cells[2].Value = "メモ";

template.Content.Rows[0].Cells[0].DateFormat = "{MonthDay}";
template.Content.Rows[0].Cells[0].CellStyleName = "defaultStyle";
template.Content.Rows[0].Cells[1].DateFormat = "{DayOfWeek}";
template.Content.Rows[0].Cells[1].CellStyleName = "defaultStyle";
gcCalendarGrid1.Template = template;

var monthMultiColumnView = new CalendarMonthMultiColumnView();
monthMultiColumnView.Orientation = Orientation.Vertical;
monthMultiColumnView.ColumnBreaks = null;
monthMultiColumnView.MonthCount = 3;
gcCalendarGrid1.CalendarView = monthMultiColumnView;

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

参照

 

 


© 2008 GrapeCity inc. All rights reserved.