Can't find what you're looking for?

Contact us or post in our forums and we'll help you find an answer.

Change calendar component size in C1CalendarView

Background:

C1CalendarView has Size property that defines the height and width of the total control. However, if the developer needs to resize the calendar component too present inside C1CalendarView control then there is no direct method.

Steps to Complete:

In addition to setting CalendarView’s Size property one should use the control API to resize the C1CalendarView’s Calendar component.

Size newSize = new Size(400, 500);
c1CalendarView.Size = newSize;
C1.Framework.Element calendarElmnt = (c1CalendarView.Controls[0] as C1.Framework.XView).Element;
Rectangle newBounds = new Rectangle(new Point(0, 0), newSize);
var monthElmnt = ((C1.Framework.BasePanel)calendarElmnt).Children[0];
monthElmnt.Size = new Size(newSize.Width - 50, newSize.Height - 50); //leaving space around calendar 
monthElmnt.Bounds = newBounds;
Get the Latest Version of WinForms Edition
Download the Free Trial Now