We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Looking for more details

Hi,

I am using the Schedule Control in one of my apps. It is great!   I would like to have icons appear on the monthly view to indicate certain events rather than shortened text describing the event. Is that possible?  Also, let's say I have some kind of event that I want to show up as a particular color on the calendar. How can I do that?  Is there a document that describes the full api! ?

I would also like to thank Syncfusion for their great attitude toward startup companies.  I left my position as Head of Information Security at Kaspersky labs to create the most advanced hacker defense tools available.  I have been coding alone for five years and am now demonstrating the product. I only have a few Syncfusion controls built in right now, but they are critical.  The app is not "slick" and I plan to replace all standard controls with Syncfusion controls.  The system has components in Xamarin, Winforms and several other places. I could not afford the full price licensing.  But it is an Enterprise app and when I have revenue, I'm more than happy to pay all full licensing fees.  Your liberal policy has made me a Syncfusion customer for life!  Plus, by not accepting investment capital, I can offer the product for free to small companies and non-profits. It can change the world in the way Information Security is done.

So, thanks for that!

BTW: If you CISO wants to run a pilot, I would be happy to do it!

Best Regards,

Craig

1 Reply

AA Arulraj A Syncfusion Team January 4, 2019 08:46 AM UTC

Hi Craig, 
 
Thanks for using Syncfusion product. 
 
Query 
Response 
 I would like to have icons appear on the monthly view to indicate certain events rather than shortened text describing the event. Is that possible? 
By default, ScheduleControl does not have the direct support to load the image for specific events. But, You could achieve your reported scenario by handling the DrawCellDisplayText event. Please refer the following code example and the sample. 
 
C# 
this.scheduleControl1.GetScheduleHost().DrawCellDisplayText += Form1_DrawCellDisplayText; 
void Form1_DrawCellDisplayText(object sender, Syncfusion.Windows.Forms.Grid.GridDrawCellDisplayTextEventArgs e) 
{ 
    if (e.Style.CellValue.ToString().Contains("subject")) 
    {                  
        string date = e.Style.CellValue.ToString().Substring(0, e.Style.CellValue.ToString().IndexOf("")); 
        DateTime dateTime; 
        if (e.RowIndex == 1 && e.ColIndex == 1) 
        { 
            dateTime = DateTime.ParseExact(date, this.scheduleControl1.Appearance.WeekMonthNewMonth, this.scheduleControl1.Culture).Date; 
        } 
        else 
        { 
            dateTime = DateTime.Parse(date, this.scheduleControl1.Culture).Date; 
        } 
        IScheduleAppointmentList list = this.scheduleControl1.DataSource.GetSchedule(dateTime, dateTime); 
        Color c = ((ListObject)scheduleProvider.GetLabels()[4]).ColorMember; 
        Rectangle rect = e.TextRectangle; 
        Rectangle eventRect = new Rectangle(rect.X + 6, rect.Y + 22, e.ClipBounds.Width, 27); 
        foreach (IScheduleAppointment item in list) 
        { 
            c = ((ListObject)scheduleProvider.GetLabels()[item.LabelValue]).ColorMember; 
            if (dateTime.Date == DateTime.Now.Date) 
            { 
                Bitmap bmp = SystemIcons.Application.ToBitmap(); 
                Size size = new Size(bmp.Width, eventRect.Height); 
                Bitmap img = new Bitmap(bmp, size); 
                e.Graphics.FillRectangle(new SolidBrush(c), eventRect); 
                e.Graphics.DrawImage(img, eventRect.Location); 
            } 
            else 
            { 
                e.Graphics.FillRectangle(new SolidBrush(c), eventRect); 
                e.Graphics.DrawString(item.Subject, e.Style.GdipFont, new SolidBrush(e.Style.TextColor), new Point(eventRect.X + 2, eventRect.Y + 12)); 
            } 
            eventRect.Y += eventRect.Height + 7; 
        } 
    } 
}  
 
Please refer the following KB link, 
Also, let's say I have some kind of event that I want to show up as a particular color on the calendar. How can I do that?  Is there a document that describes the full api! ? 
To customize the events color, you could implement the custom ScheduleDataProvider and override the InitLists and Getlabels method . Please refer the following kb link, 
 
 

Regards, 
Arulraj A 


Loader.
Live Chat Icon For mobile
Up arrow icon