- Welcome, Guest. Please Login or Register
MindFusion  
  Version 2 of our Xamarin Calendar component adds Resource view and support for Universal Windows Platform. Now beta testing spreadsheet component for Java Swing.  
  HomeHelpSearchLoginRegister   
     
     
   
 
Page Index Toggle Pages: 1 Send Topic Print  
Sizing calendar
Read 355 times

john6630   Offline
Junior Member
**
Posts: 74
I love YaBB 1G - SP1!


   
     
 
Sizing calendar
Mar 17th, 2017 at 6:26pm
 
I would like to set the calendar height in time table view to exactly fit the time cells, header and border. Currently if I size the calendar to fit the height of the panel containing the calendar it displays an large cell at the bottom of the calendar. If the panel is smaller, it fits fine with the addition of vertical scroll bar. See the attached image to see what I am talking about.

Thank you,
John
 
 

Capture_001.JPG (141 KB | 53 )
Capture_001.JPG
 
IP Logged    
 
     

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


   
     
 
Re: Sizing calendar
Reply #1 - Mar 20th, 2017 at 9:25am
 
Hi,

You can calculate the total height by multiplying the number of cells by the cell size and adding the height of the header(s).

Code:
var settings = calendar.TimetableSettings;
int cellCount = (int)Math.Ceiling((settings.EndTime - settings.StartTime) / settings.CellTime.TotalMinutes);
var headerBounds = calendar.GetElementBounds(CalendarElement.TimetableColumnHeader, 0);
int height = cellCount * settings.CellSize + headerBounds.Height; 



I hope this helps.

Regards,
Meppy
 
 
 
IP Logged    
 
     

john6630   Offline
Junior Member
**
Posts: 74
I love YaBB 1G - SP1!


   
     
 
Re: Sizing calendar
Reply #2 - Mar 21st, 2017 at 12:10am
 
Hi Meppy,
That helps. I think my difficulty is in how to set the timetable start and end times for a 24 hour period not starting at midnight. IE 6AM day 1 to 6AM day 2. Can you advise how best to do that?

Thanks,
John
 
 
 
IP Logged    
 
     

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


   
     
 
Re: Sizing calendar
Reply #3 - Mar 21st, 2017 at 9:25am
 
Hi,

Use the StartTime and EndTime properties of the TimetableSettings class:

Code:
calendar.TimetableSettings.StartTime = 360; // 6 AM in minutes
calendar.TimetableSettings.EndTime = 1800; // 6 AM on the following day 


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