Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Appointment fill color (Read 6304 times)
bpeacock
YaBB Newbies
*
Offline


War Eagle!

Posts: 14
Joined: Mar 8th, 2007
Appointment fill color
Mar 27th, 2007 at 11:26am
Print Post  
I am populating a calendar with appointments and need to set the fill color to specific colors based on a status.  The color with not set.   I am trying this with single month and timetable views.   The border color will set fine.  Is there a calendar level attribute that may be causing this?

Funny thing is this is working in another part of the application I am working on.  These are separate calendars.  One works and one doesn't.

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


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Appointment fill color
Reply #1 - Mar 27th, 2007 at 11:48am
Print Post  
Have you tried settings the Brush property of the Style object associated with the item? For example if 'item' is a variable referencing the Item whose background color you would like to change, here is a sample code that should do this:

Code
Select All
item.Brush = MindFusion.Drawing.SolidBrush(Color.Green); 



Meppy
  
Back to top
 
IP Logged
 
bpeacock
YaBB Newbies
*
Offline


War Eagle!

Posts: 14
Joined: Mar 8th, 2007
Re: Appointment fill color
Reply #2 - Mar 27th, 2007 at 12:43pm
Print Post  
I have a class that inherits the calendar and the code below is from a sub that is used when I  loop through my dates and add appointments to the calendar.  The appointments add fine but the fill color just doesn't set.  The border color will set just fine.

Appointment appt = new Appointment();
appt.Subject = "Some subject";
appt.Details = "Some details";
appt.StartTime = Some StartTime;
appt.EndTime = Some end time;

//Some logic goes here that determines a specific color to use below. 

//Defaulted to red for this example
Color color = Color.Red;

//I tried this
appt.Style.Brush = new MindFusion.Drawing.SolidBrush(color);

//and tried this
appt.Style.FillColor = color;

//I am setting border colors as well and this works
//Example for just the top border
appt.Style.BorderTopColor = color;
appt.Style.BorderTopWidth = 1;

//Add the appointment to the schedule
base.Schedule.Items.Add(appt);

Thanks

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Appointment fill color
Reply #3 - Mar 27th, 2007 at 1:51pm
Print Post  
Hi,

What happens if you set the Style.HeaderBrush?

Stoyan
  
Back to top
 
IP Logged
 
bpeacock
YaBB Newbies
*
Offline


War Eagle!

Posts: 14
Joined: Mar 8th, 2007
Re: Appointment fill color
Reply #4 - Mar 27th, 2007 at 2:22pm
Print Post  
I tried this

appt.Style.HeaderBrush = new MindFusion.Drawing.SolidBrush(Color.Red);

Still doesn't fill the box.  Border is red and the center box is a blue color.

If you are at the calendar level, and set this

this.ItemSettings.Style.Brush = new MindFusion.Drawing.SolidBrush(Color.Red);

the box fills, but this is for all appointments.  I need to be able to color appointments with different colors based on logic.

It seems like something at the calendar level is overriding the color I set when loading appointments.

Thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Appointment fill color
Reply #5 - Mar 27th, 2007 at 2:44pm
Print Post  
Are the items selected, by any chance? You would have to use the SelectedStyle.Brush to change the fill color of selected items. Could you also try to display the Style.Brush values for all items upon a button click, to check if they aren't changed at some point after you initially set them?

Stoyan
  
Back to top
 
IP Logged
 
bpeacock
YaBB Newbies
*
Offline


War Eagle!

Posts: 14
Joined: Mar 8th, 2007
Re: Appointment fill color
Reply #6 - Mar 27th, 2007 at 4:24pm
Print Post  
The appointments(items) are not selected.  I can try the button click.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint