Ok, let me talk. I have several of these controls behind me, so maybe I can help solve these problems.
- determine what the smallest slot you want to display on the screen is - say, 15 minutes.
- divide the viewing area into slots of this duration - if you need to display 6 hours, create a list of 4x6 = 24 elements
- each item will be a list of schedule objects found there
- iterate your planning objects and assign them to a list.
iterate list and draw. You should have enough information to display as shown above.
class ScheduleItem {DateTime start; DateTime end; string someText; }
class OneSlot {List <ScheduleItem> ItemsInSlot; }
List <OneSlot> VisibleSlots;
If you need pixel accuracy (you really don't need second accuracy here because you are not moving in time on the screen), you make the slot as small as you are here.
8 hours - 28800 seconds; if you have set a time interval of 30 seconds, 960 time intervals will be available for display on the screen.
Hope this helps, please comment me if you need to continue discussing this issue.
source share