- Welcome, Guest. Please Login or Register
MindFusion  
  Now beta testing first versions of our Scheduler and Virtual Keyboard components for HTML & JavaScript.  
  HomeHelpSearchLoginRegister   
     
     
   
 
Page Index Toggle Pages: 1 Send Topic Print  
Enlight past appointments like Google Calendar
Read 53 times

fractal07   Offline
YaBB Newbies
*
Posts: 23
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: 1776
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: 23
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: 1776
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    
 
     
Page Index Toggle Pages: 1 Send Topic Print