Determines the number of month rows and columns to display.
This example uses the control's MonthDimensions property to display a different number of months depending on how many months remain in the current year.
Private Sub SetupMonthDimensions()
' First, determine how many months, including the current month,
' remain in the current year
Dim monthsToDisplay As Integer = Me.ultraMonthViewMulti1.CalendarInfo.MonthsOfYear.Count - DateTime.Today.Month + 1
Dim dimensions As Size
If (monthsToDisplay <= 4) Then
' If there are 4 or less months remaining, make it 1 row
dimensions = New Size(monthsToDisplay, 1)
Else
If (monthsToDisplay <= 8) Then
' If there is between 5 and 8 months remaining, make it 2 rows
dimensions = New Size(4, 2)
Else
' If there is more than 8 months remaining, make it 3 rows
dimensions = New Size(4, 3)
End If
' Set the MonthDimensions property to the new dimensions
Me.ultraMonthViewMulti1.MonthDimensions = dimensions
End If
End Sub
'Declaration
Public Property MonthDimensions As Size
private void SetupMonthDimensions()
{
// First, determine how many months, including the current month,
// remain in the current year
int monthsToDisplay = (this.ultraMonthViewMulti1.CalendarInfo.MonthsOfYear.Count - DateTime.Today.Month) + 1;
Size dimensions;
if ( monthsToDisplay <= 4 )
{
// If there are 4 or less months remaining, make it 1 row
dimensions = new Size( monthsToDisplay, 1 );
}
else
if ( monthsToDisplay <= 8 )
{
// If there is between 5 and 8 months remaining, make it 2 rows
dimensions = new Size( 4, 2 );
}
else
{
// If there is more than 8 months remaining, make it 3 rows
dimensions = new Size( 4, 3 );
}
// Set the MonthDimensions property to the new dimensions
this.ultraMonthViewMulti1.MonthDimensions = dimensions;
}
'Declaration
Public Property MonthDimensions As Size
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, 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