10823 : how to handle the mouseEnter and mouseLeave events for the time item?

Question

How to handle the mouseEnter and mouseLeave events for the time item. Actually i want to change the color of timeitem when mouse entered and again apply the previous color when mouse leaves

Answer

Implement the event OnTimeItemAreaMouseMove. In this event look up the timeItem currently under the mouse with Gantt.TimeItemFromPoint.

Remember the result in a member variable, beware that the result might be null (mouse currently not over any time item) .

If the member variable with the time item changes value, then the old time item should get its default time item layout back: _oldRemeberedTimeItem.TimeItemLayout=DefaultTimeItemLayout, and the new value should be given a TimeItemLayout that represent “Mouse is over me”.

It is not an uncommen mistake to change the TimeItemLayout’s values, and thus changing the look for all time items with that time item layout. You should of course change the time items so that it points to a different time item layout to get the desired effect of only changing one time item.