The control uses the font of the Appearance to calculate the size required to display each day since all months must be the same size. If this were not the case, the control's size would change (or the number of months displayed would change) as the user scrolled from month to month. Since the control can share a common UltraCalendarInfo and font information can be applied as specifically as to a Day object, the control must override the font settings - specifically the font name and size - so that the day numbers are all displayed. This also applies to week numbers, month headers and day of week captions. The OverrideFontSettings, when set to false, will prevent the control from overriding these settings and use the specific resolved properties for each of those objects.
Note: When this property is set to false, the resolved font name and size from the specific object will be used but the size of the day, etc. will remain the same. Therefore, the information displayed may be clipped.
Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports Infragistics.Win.UltraWinSchedule.MonthViewMulti Private Sub SizeCalendarForDayAppearance() ' Set the DayAppearance's FontData properties (change these values as desired) Me.ultraMonthViewMulti1.CalendarLook.DayAppearance.FontData.Name = Me.ultraMonthViewMulti1.Font.Name Me.ultraMonthViewMulti1.CalendarLook.DayAppearance.FontData.SizeInPoints = 12 ' We will only do this if the font of the CalendarLook's DayAppearance ' is set we can determine this by checking the SizeInPoints property ' for a value that is > 0. If (Me.ultraMonthViewMulti1.CalendarLook.DayAppearance.FontData.SizeInPoints > 0.0F) Then ' Create a graphics object Dim g As Graphics = Me.ultraMonthViewMulti1.CreateGraphics() ' Create a font from the DayAppearance's FontData Dim font As Font = New Font(Me.ultraMonthViewMulti1.CalendarLook.DayAppearance.FontData.Name, Me.ultraMonthViewMulti1.CalendarLook.DayAppearance.FontData.SizeInPoints) ' Use MeasureString to get the size of the rect ' needed to display a day with the current font Dim sizeDay As Size = g.MeasureString("31", font).ToSize() ' Make the dimensions a perfect square, using whichever ' value was larger, the width or height Dim dimension As Integer = System.Math.Max(sizeDay.Height, sizeDay.Width) sizeDay = New Size(dimension, dimension) ' Set the MinimumDaySize property to be large enough ' to accommodate the DayAppearance font Me.ultraMonthViewMulti1.MinimumDaySize = sizeDay ' Set the OverrideFontSettings property to false so the ' control uses the DayAppearance font settings Me.ultraMonthViewMulti1.OverrideFontSettings = False ' Dispose of the graphics and font objects g.Dispose() font.Dispose() End If End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using Infragistics.Win.UltraWinSchedule.MonthViewMulti; private void SizeCalendarForDayAppearance() { // Set the DayAppearance's FontData properties (change these values as desired) this.ultraMonthViewMulti1.CalendarLook.DayAppearance.FontData.Name = this.ultraMonthViewMulti1.Font.Name; this.ultraMonthViewMulti1.CalendarLook.DayAppearance.FontData.SizeInPoints = 12; // We will only do this if the font of the CalendarLook's DayAppearance // is set; we can determine this by checking the SizeInPoints property // for a value that is > 0. if ( this.ultraMonthViewMulti1.CalendarLook.DayAppearance.FontData.SizeInPoints > 0.0F ) { // Create a graphics object Graphics g = this.ultraMonthViewMulti1.CreateGraphics(); // Create a font from the DayAppearance's FontData Font font = new Font( this.ultraMonthViewMulti1.CalendarLook.DayAppearance.FontData.Name, this.ultraMonthViewMulti1.CalendarLook.DayAppearance.FontData.SizeInPoints ); // Use MeasureString to get the size of the rect // needed to display a day with the current font Size sizeDay = g.MeasureString( "31", font ).ToSize(); // Make the dimensions a perfect square, using whichever // value was larger, the width or height int dimension = System.Math.Max( sizeDay.Height, sizeDay.Width ); sizeDay = new Size( dimension, dimension ); // Set the MinimumDaySize property to be large enough // to accommodate the DayAppearance font this.ultraMonthViewMulti1.MinimumDaySize = sizeDay; // Set the OverrideFontSettings property to false so the // control uses the DayAppearance font settings this.ultraMonthViewMulti1.OverrideFontSettings = false; // Dispose of the graphics and font objects g.Dispose(); font.Dispose(); } }
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