Imports GrapeCity.Win.CalendarGrid
Dim weekView As New CalendarWeekView()
GcCalendarGrid1.CalendarView = weekView
Dim calendarHeaderHeight As Integer = GcCalendarGrid1.TitleHeader.Height
Dim headerHeight As Integer = 0
Dim template As CalendarTemplate = GcCalendarGrid1.Template
For i As Integer = 0 To template.ColumnHeader.RowCount - 1
headerHeight += template.ColumnHeader.Rows(i).Height
Next
Dim contentHeight As Integer = 0
For i As Integer = 0 To template.Content.RowCount - 1
contentHeight += template.Content.Rows(i).Height
Next
Dim freeSpace As Integer = GcCalendarGrid1.ClientRectangle.Height
freeSpace -= calendarHeaderHeight
freeSpace -= headerHeight
Dim weekCount As Integer = 0
If freeSpace > contentHeight Then
weekCount = freeSpace / contentHeight
End If
weekView.WeekCount = weekCount
using GrapeCity.Win.CalendarGrid;
var weekView = new CalendarWeekView();
gcCalendarGrid1.CalendarView = weekView;
int calendarHeaderHeight = gcCalendarGrid1.TitleHeader.Height;
int headerHeight = 0;
var template = gcCalendarGrid1.Template;
for (int i = 0; i < template.ColumnHeader.RowCount; i++)
{
headerHeight += template.ColumnHeader.Rows[i].Height;
}
int contentHeight = 0;
for (int i = 0; i < template.Content.RowCount; i++)
{
contentHeight += template.Content.Rows[i].Height;
}
int freeSpace = gcCalendarGrid1.ClientRectangle.Height;
freeSpace -= calendarHeaderHeight;
freeSpace -= headerHeight;
int weekCount = 0;
if (freeSpace > contentHeight)
{
weekCount = freeSpace / contentHeight;
}
weekView.WeekCount = weekCount;