Copyright Accelerated Ideas 2007 Legacy Blog Posts | Blog Home | .NET Components

AICalendar – How to alter day colours and images


1/2/2007

Altering specific days on the AICalendar is so simple. Developers must first retrieve a reference to the Day on the calendar that they require. Remember that each day on the Calendar is an individual AIDayPanel that encapsulates the Title, Description, Colour etc..

So first we must get the reference to the Day we want. This can be done by using the GetPanel() method of the AICalendar passing a date of the day to retrieve:

Our demo application constructs a DateTime variable from the first day on the Calendar just as a simple example:

DateTime aDate = new DateTime(aiCalendar1.CurrentYear, aiCalendar1.CurrentMonth, 1);


Next we can call the GetPanel method using the aDate variable. The return result from this method call is the AIDayPanel object (if it exists, null if it doesn’t):

AIDayPanel aDay = aiCalendar1.GetPanel(aDate);

//Add some nice colours and items to demonstrate
//----------------------------------------------

aDay = aiCalendar1.GetPanel(aDate);
if (aDay != null)
{
aDay.Image = (Bitmap)(imageList1.Images[2]);
aDay.BlendColor = Color.LightGreen;
aDay.Description = \"This day has been signed off\";
}


Now, using the AIDayPanel reference we can edit any of the following properties for the day including:

Image – The image for the day, shown at the top right of the day
Blendcolor – the colour for the day
Description – the main description for the day, shown in the middle of the day panel
(many more properties exist, see readme.htm file for details)

We recommend that you use an imagelist object to hold the images for the AICalendar days. Developers can then reference images by index:

(Bitmap)(imageList1.Images[2]);


< Blog Home