10388 : Im interested in having some read only time items in a gantt.

Question

I’m interested in having some read only time items in a gantt. These time items are only there to show aggregate data (the total number of hours worked per employee). I don’t want the user to be able to modify them or select them on the gantt. When the user’s mouse hovers over these time items I don’t even want the mouse cursor to change into a hand.

I saw the suggestions in this article:

http://plexityhide.dyndns.org/InstantKB13/Article.aspx?id=10026

Unfortunately, the items are still selectable and the mouse cursor acts as if they are movable items.

Ideally, I’d like to draw information on the “background” of the gantt row at the beginning of each week which states the total number of hours worked for that user for the week. How I was going to accomplish this was adding another layer to the gantt which was databound to a rollup table I calculate which contains this data.

Is there a better way which you would recommend I use to achieve the desired effect?

Answer

To get information into the background that is truly “dead” and allows no interaction I suggest that you implement the OnTimeItemAreaPaintBackground event as described in this article: http://plexityhide.dyndns.org/InstantKB13/Article.aspx?id=10066

You can use the Gantt.DateScaler.TimeToPixel method to translate a time to an exact pixel position so that you place your info on the exact correct place.

 

2 thoughts on “10388 : Im interested in having some read only time items in a gantt.

  1. Hi,

    I have successfully used the above suggestion to draw specific days in a different color,

    My question is would it be possible to do something similar on a node by node basis?

    ie lets says for 1 node i wish to highlight sundays, on another wednesdays etc

    So rather than specifying a background per column, I wish to highlight per “cell” in the gantt area

    Any suggestions would be greatly appreciated.

    Kind Regards,
    Daniel

  2. Sure you can in the OnTimeItemAreaPaintBackground event iterate thru the gridnodes. Start at the Gantt.Grid.GridStructure.TopNode node so you dont waste time on things above visible screen. Then for each GridNode get the Rect property – this gives you the Top and Bottom – then use DateScaler.TimeToPixel to get the x start and stop – then draw a rectangle…

Leave a Reply