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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to customize the label, marker and reminder colors of appointments in WinForms ScheduleControl?

Platform: WinForms |
Control: ScheduleControl

Customize the label, marker and reminder color of appointments

By default, the color will be set to appointment based on IScheduleAppointment.LabelValue. In order to change the custom color for the appointment label, DrawCellDisplayText event can be used.

C#

//Event Subscription
this.scheduleControl1.GetScheduleHost().DrawCellDisplayText += Form1_DrawCellDisplayText;
 
//Event Customization
void Form1_DrawCellDisplayText(object sender, Syncfusion.Windows.Forms.Grid.GridDrawCellDisplayTextEventArgs e)
{
    if (e.Style.CellValue.ToString().Contains("subject"))
    {
        Color c = ((ListObject)scheduleProvider.GetLocations()[2]).ColorMember;
        Rectangle rect = e.TextRectangle;
        rect.Y += 16;
        rect.Height -= 16;
        e.Graphics.FillRectangle(new SolidBrush(c), rect.X, rect.Y + 10, rect.Width - 2, 20);
        e.Graphics.DrawString("Subject  Mon:Tue", e.Style.GdipFont, new SolidBrush(e.Style.TextColor), new Point(rect.X + 2, rect.Y + 12));
    }
}

VB

'Event Subscription
AddHandler Me.scheduleControl1.GetScheduleHost().DrawCellDisplayText, AddressOf Form1_DrawCellDisplayText
 
'Event Customization
Private Sub Form1_DrawCellDisplayText(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridDrawCellDisplayTextEventArgs)
    If e.Style.CellValue.ToString().Contains("subject") Then
        Dim c As Color = (CType(scheduleProvider.GetLocations()(2), ListObject)).ColorMember
        Dim rect As Rectangle = e.TextRectangle
        rect.Y += 16
        rect.Height -= 16
        e.Graphics.FillRectangle(New SolidBrush(c), rect.X, rect.Y + 10, rect.Width - 2, 20)
        e.Graphics.DrawString("Subject  Mon:Tue", e.Style.GdipFont, New SolidBrush(e.Style.TextColor), New Point(rect.X + 2, rect.Y + 12))
    End If
End Sub

Screenshot

Customize the label, marker and reminder color

Note:

The Grid.Windows.dll should be added to the assembly reference to access the DrawCellDisplayText event.

Samples:

C#: Custom_Appointment_Color_CS

VB: Custom_Appointment_Color_VB

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile