Articles in this section
Category / Section

How to change the back color of special dates in WinForms ScheduleControl?

1 min read

Change the back color of special dates

You can set different colors for specific days in the WinForms Schedule control. This can be achieved by checking the Column index and using the QueryCellInfo event. In the following code example, different colors for the 5th and 6th columns are applied.

C#

//sets the color of prime time cells in the calendar.
this.scheduleControl1.Appearance.PrimeTimeCellColor = Color.FromArgb(0, Color.Wheat);
//sets the color of prime time cells in the calendar.
this.scheduleControl1.Appearance.NonPrimeTimeCellColor = Color.FromArgb(0, Color.Wheat);
this.scheduleControl1.GetScheduleHost().QueryCellInfo += new Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventHandler(Form1_QueryCellInfo);
void Form1_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e)
{
    if (e.ColIndex == 5)
    {
        //Applies back color for 5th column.
        e.Style.BackColor = Color.LightSkyBlue;
    }
    if (e.ColIndex == 6)
    {
        //Applies back color for 6th column.
        e.Style.BackColor = Color.Pink;
    }
}

 

VB

'Sets the color of prime time cells in the calendar.
Me.scheduleControl1.Appearance.PrimeTimeCellColor = Color.FromArgb(0, Color.Wheat)
'Sets the color of Non-prime time cells in the calendar.
Me.scheduleControl1.Appearance.NonPrimeTimeCellColor = Color.FromArgb(0, Color.Wheat)
AddHandler scheduleControl1.GetScheduleHost().QueryCellInfo, AddressOf Form1_QueryCellInfo
void Form1_QueryCellInfo(Object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e)
   If e.ColIndex = 5 Then
       'Applies back color for 5th column.
       e.Style.BackColor = Color.LightSkyBlue
   End If
   If e.ColIndex = 6 Then
       'Applies back color for 6th column.
       e.Style.BackColor = Color.Pink
   End If
End Sub

 

Change the back color of special dates in WinForms Schedule

 

Samples:

C#: ScheduleControl_CS

VB: ScheduleControl_VB

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments
Please sign in to leave a comment
Access denied
Access denied