月の日付を 6 行×7 列に表示する月ビューを表します。各行は 1 週間を表します。
Dimensions は、1 つのビューに表示する月の行×列数を指定します。
次のサンプルコードは、CalendarMonthView の使用方法を示します。このサンプルコードは、
GcCalendarGrid.CalendarView 設定に示されている詳細なコード例の一部を抜粋したものです。
private void UseMonthView()
{
CalendarMonthView monthView = new CalendarMonthView();
monthView.Dimensions = new Size(3, 4);
monthView.MinScrollCount = 12;
this.gcCalendarGrid1.CalendarView = monthView;
CalendarTemplate template = new CalendarTemplate(1, 1, 2, 1);
template.ColumnHeader.CellStyle.Alignment = CalendarGridContentAlignment.MiddleCenter;
template.ColumnHeader[0, 0].DateFormat = CalendarDateFormats.Month;
template.ColumnHeader[0, 0].AutoMergeMode = AutoMergeMode.Horizontal;
template.ColumnHeader[1, 0].DateFormat = CalendarDateFormats.ShortestDayOfWeek;
template.RowHeader.CellStyle.Alignment = CalendarGridContentAlignment.MiddleCenter;
template.RowHeader.CellStyle.ForeColor = Color.Green;
template.RowHeader.Columns[0].Width = 30;
template.RowHeader[0, 0].DateFormat = CalendarDateFormats.WeekNumber;
template.RowHeader[0, 0].CellStyle.Alignment = CalendarGridContentAlignment.MiddleCenter;
template.Content.Columns[0].Width = 30;
template.Content.CellStyleName = this.gcCalendarGrid1.Styles[0].Name;
template.Content[0, 0].DateFormat = CalendarDateFormats.Day;
this.gcCalendarGrid1.Template = template;
this.gcCalendarGrid1.FirstDateInView = new DateTime(DateTime.Today.Year, 1, 1);
}
Private Sub UseMonthView()
Dim monthView As New CalendarMonthView()
monthView.Dimensions = New Size(3, 4)
monthView.MinScrollCount = 12
Me.gcCalendarGrid1.CalendarView = monthView
Dim template As New CalendarTemplate(1, 1, 2, 1)
template.ColumnHeader.CellStyle.Alignment = CalendarGridContentAlignment.MiddleCenter
template.ColumnHeader(0, 0).DateFormat = CalendarDateFormats.Month
template.ColumnHeader(0, 0).AutoMergeMode = AutoMergeMode.Horizontal
template.ColumnHeader(1, 0).DateFormat = CalendarDateFormats.ShortestDayOfWeek
template.RowHeader.CellStyle.Alignment = CalendarGridContentAlignment.MiddleCenter
template.RowHeader.CellStyle.ForeColor = Color.Green
template.RowHeader.Columns(0).Width = 30
template.RowHeader(0, 0).DateFormat = CalendarDateFormats.WeekNumber
template.RowHeader(0, 0).CellStyle.Alignment = CalendarGridContentAlignment.MiddleCenter
template.Content.Columns(0).Width = 30
template.Content.CellStyleName = Me.gcCalendarGrid1.Styles(0).Name
template.Content(0, 0).DateFormat = CalendarDateFormats.Day
Me.gcCalendarGrid1.Template = template
Me.gcCalendarGrid1.FirstDateInView = New DateTime(DateTime.Today.Year, 1, 1)
End Sub