Winforms-Calendar icon indicating copy to clipboard operation
Winforms-Calendar copied to clipboard

Use Calendar.SetRenderHourRange(int StartHour, int EndHour).

Open toshiya14 opened this issue 5 years ago • 6 comments

Use Calendar.SetRenderHourRange(int StartHour, int EndHour) to render a range of time for each day. But actually not fully be tested.

toshiya14 avatar Apr 20 '20 17:04 toshiya14

Thanks for creating this. I'll take a look at it and test it out as soon as I get a chance

derekantrican avatar Apr 20 '20 23:04 derekantrican

I can't seem to get your changes to work in the test harness project. Check below and see if I'm doing something wrong

derekantrican avatar Apr 22 '20 00:04 derekantrican

I can't seem to get your changes to work in the test harness project. Check below and see if I'm doing something wrong

Please do not directly set the StartHour and EndHour. Because something were done within the constructor of CalendarDay. Please use the SetRenderHourRange(int StartHour, int EndHour) of the Calendar object instead. After assign the value to StartHour and EndHour, the Calendar object would useUpdateDaysAndWeeks() to re-construct the Days within the Calendar object and using new assigned StartHour and EndHour.

toshiya14 avatar Apr 22 '20 08:04 toshiya14

Notes: I am guessing a situation which might cause some unexpected bugs. There might be some problem if set an item out of the display range. For example, if you calendar.SetRenderHourRange(9, 18), and add an item which is started from 17 and end with 19. Or started from 19 and end with 20. I will try to verify it and resolve it. This project is really complicated and might spend times, XD.

toshiya14 avatar Apr 22 '20 08:04 toshiya14

If I try to use calendar.SetRenderHourRange with the Test Harness then I get an exception. Maybe this is due to the thing you were talking about?

image

derekantrican avatar Apr 23 '20 00:04 derekantrican

I have update some code in the test project. It seems work now, but still have some problem. 😢

  1. When the first time the calendar appears, it is not looks good. If you try to scroll it with mouse wheel, the problem could be solved. (Maybe it is needed to be re-painted manually?)
  2. If the calendar is short than the window, scrolling it with mouse wheel, it is not looks good.
  3. When you click some date from the month view on the left, then back to today, it disappeared. (🤨)

==================== Seems that the CodeProject version is not as same as this version. And this version is more complecated.

toshiya14 avatar Apr 23 '20 23:04 toshiya14