Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to change the color of a single column (Read 3098 times)
ctusch
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Jan 11th, 2010
How to change the color of a single column
Jan 11th, 2010 at 10:23am
Print Post  
Hey,

is it possible to change the color of a specific column (i.e. a single day)?

Thanks!
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: How to change the color of a single column
Reply #1 - Jan 11th, 2010 at 11:14am
Print Post  
Hi,

I presume you are referring to the Timetable view. In this case the only way to change the color of the cells in a specific column is through custom drawing. You have to set the Calendar.CustomDraw property to TimetableCell, handle the Calendar.Draw event and perform the necessary drawing in the event handler. The following code demonstrates how to custom-draw cells associated with Jan 12th, 2010:

Code
Select All
private void calendar1_Draw(object sender, MindFusion.Scheduling.WinForms.DrawEventArgs e)
{
      if (e.Date == new DateTime(2010, 1, 12))
      {
            Rectangle bounds = e.Bounds;
            bounds.Inflate(-1, -1);
            if (e.StartTime.TotalHours < calendar1.TimetableSettings.WorkTimeStartHour ||
                  e.EndTime.TotalHours > calendar1.TimetableSettings.WorkTimeEndHour)
            {
                  e.Graphics.FillRectangle(Brushes.Red, bounds);
            }
            else
            {
                  e.Graphics.FillRectangle(Brushes.Yellow, bounds);
            }
      }
} 


The code paints non-working cells in red and working cells in yellow. You may need to perform additional checks whether a cell is selected or not in order to paint selected cells in distinguishable colors.

Regards,
Meppy
  
Back to top
 
IP Logged
 
ctusch
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Jan 11th, 2010
Re: How to change the color of a single column
Reply #2 - Jan 12th, 2010 at 12:23pm
Print Post  
It works, thanks!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint