- Welcome, Guest. Please Login or Register
MindFusion  
  We have released initial version of MindFusion.Scheduling library for HTML5 & JavaScript.  
  HomeHelpSearchLoginRegister   
     
     
   
 
Page Index Toggle Pages: 1 Send Topic Print  
Enlight past appointments like Google Calendar
Read 386 times

fractal07   Offline
YaBB Newbies
*
Posts: 28
Gender: male
France
I Love MindFusion!


   
     
 
Enlight past appointments like Google Calendar
Dec 5th, 2017 at 8:24am
 
Hello,
Using Winforms > Scheduler > Timetable display, is there an easy way to change opacity or enlight/darken past events to increase the visilibity of futures appointments?
Kind regards
 
 
 
IP Logged    
 
     

Meppy   Offline
YaBB Moderator
*****
Posts: 1783
Gender: male
MindFusion support


   
     
 
Re: Enlight past appointments like Google Calendar
Reply #1 - Dec 5th, 2017 at 12:42pm
 
Hi,

You can set collect the past items and manually set their background brush to a brighter, darker or a semi-transparent version of the default brush. For example, to change the background of an item to a more transparent one, use the following code:

Code:
var defaultBrush = calendar.ItemSettings.Style.Brush as MindFusion.Drawing.SolidBrush;
item.Style.Brush = new MindFusion.Drawing.SolidBrush(Color.FromArgb(100, defaultBrush.Color)); 


To collect the past items, you can use one of the Schedule.GetAllItems overload, or you can do it manually, like this:

Code:
foreach (var item in calendar.Schedule.Items.Where(i => i.EndTime < DateTime.Now))
{
  // Set the item's background
} 


Regards,
Meppy
 
 
 
IP Logged    
 
     

fractal07   Offline
YaBB Newbies
*
Posts: 28
Gender: male
France
I Love MindFusion!


   
     
 
Re: Enlight past appointments like Google Calendar
Reply #2 - Dec 5th, 2017 at 1:16pm
 
Thank you for your quick reply!
If I do this in the Draw event, it will not overload the method?
 
 
 
IP Logged    
 
     

Meppy   Offline
YaBB Moderator
*****
Posts: 1783
Gender: male
MindFusion support


   
     
 
Re: Enlight past appointments like Google Calendar
Reply #3 - Dec 6th, 2017 at 11:16am
 
Hi,

The Draw method is not the best place for this because it is invoked very often whereas you need to set the item backgrounds rarely, possibly even once when the items are created. Move this code to an ItemCreated or ItemModified event handler.

Regards,
Meppy
 
 
 
IP Logged    
 
     

fractal07   Offline
YaBB Newbies
*
Posts: 28
Gender: male
France
I Love MindFusion!


   
     
 
Re: Enlight past appointments like Google Calendar
Reply #4 - Mar 9th, 2018 at 10:23am
 
Sorry for the delay... Thank you for your answer, job's done! Except one tiny thing: surprisingly, the _ItemCreated event is never raised (yes, obviously the event handler is correctly set  Wink ) ?! However the _ItemModified is perfectly raised...
 
 
 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1529
Gender: male
tech.support


   
     
 
Re: Enlight past appointments like Google Calendar
Reply #5 - Mar 12th, 2018 at 9:40am
 
Hi,

ItemCreated should be raised for appointments created interactively the built-in way, by selecting a time range and typing. It's probably not raised if you add items from code, e.g. in response to click or drag/drop events.

Regards,
Slavcho
Mindfusion
 
 
 
IP Logged    
 
     
Page Index Toggle Pages: 1 Send Topic Print