10622 : Time based content in TimeItems

Question

Hi, I would like to draw tick marks inside of a time item. I am using the “OnTimeItem_UserDraw” event and that works fine. An example might be that I would like to have a time item that is 10 minutes long and draw a tick every minute. So when I zoom in and out I the ticks would move around. Is there a way to do this? Perhaps there is a way to get the start and stop time of the region being drawn?

Answer

To draw accurate time based pixels in a user drawn time item you will need to use the DateScaler.PixelToTime and DateScaler.TimeToPixel function.
You can loop from your TimeItems.Start value to TimeItem.Stop. For every second you call DateScaler.TimeToPixel and draw a scale mark.

Leave a Reply