Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Sizing calendar (Read 3816 times)
john6630
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Sep 20th, 2010
Sizing calendar
Mar 17th, 2017 at 5:26pm
Print Post  
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 | 73 Downloads )
Capture_001.JPG
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Sizing calendar
Reply #1 - Mar 20th, 2017 at 8:25am
Print Post  
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
Select All
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
  
Back to top
 
IP Logged
 
john6630
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Sep 20th, 2010
Re: Sizing calendar
Reply #2 - Mar 20th, 2017 at 11:10pm
Print Post  
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
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Sizing calendar
Reply #3 - Mar 21st, 2017 at 8:25am
Print Post  
Hi,

Use the StartTime and EndTime properties of the TimetableSettings class:

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


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


I Love MindFusion!

Posts: 28
Location: France
Joined: Mar 13th, 2017
Re: Sizing calendar
Reply #4 - May 12th, 2017 at 11:20am
Print Post  
Hello,
I carefully read you post and I wish your advise to a different calculation. My Timetable is in a form and I would to display the same time range (06:00 to 19:00) whatever is the height of the form.
To be clear: I would always see the range from startTime to endTime without any vertical scrollbar, my calendar have to fit the height of the form, the adjustment will be the cell height. Should I use zoom property?
Kind regards
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Sizing calendar
Reply #5 - May 12th, 2017 at 11:46am
Print Post  
Precisely. Set the UseZoom property and the cell sizes will be automatically calculated so that all cells fit in the visible space:

Code
Select All
calendar.TimetableSettings.UseZoom = State.Enabled;
calendar.TimetableSettings.StartTime = 360; // 6 AM in minutes
calendar.TimetableSettings.EndTime = 1140; // 7 PM in minutes 


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


I Love MindFusion!

Posts: 28
Location: France
Joined: Mar 13th, 2017
Re: Sizing calendar
Reply #6 - May 12th, 2017 at 12:07pm
Print Post  
Great, thank you! It avoids me lot of work and calculations!
(documentation is not much verbose on usage of this function...)
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint