views:

72

answers:

3

I need to create a user control, that will be used in an application used to schedule employees tasks. The control will be a two dimensions table. There will be one line for each employees. On this line, there will be 0 or more block that each represent a task this employees has to do. They will be ordered from left to right so the ones on the left will be the ones that need to be done next. Since this table will contains lot of employees and task for a couple of days, the control will need to scroll both horizontally and vertically.

I was thinking of having 3 kinds of control.

  1. The grid itself
  2. An employees tasks (a row)
  3. A task (each blocks)

Now, when the users scroll horizontally or vertically, I need the headers to stay visible and it's not trivial if I separate controls as I did.

So, I guess my questions is, how would you design such a control? Would you create a single control that does everything or separate it in multiple controls as I intend to? Would you manage the scrollbar programmatically or would you simply use the AutoScroll properties of the control?

+1  A: 

I would create a single user control. I would consider creating multiple user controls only if there was significant re-use possibilities for the individual controls. Keep in mind that it takes extra effort to communicate among user controls using events and delegates. In this case, it appears that the controls need to be tightly integrated.

I would use the AutoScroll property if it meet my needs.

Jamie Ide
Thanks for your answer, it helped me make my choice.
Mathieu Pagé
A: 

Are you able to return each of those rows (employee names and tasks) into a dataset. In otherwords can you query the data? Is the data persisted in any way? Can you fetch it back into the rows?

If so then a data grid would work.

Seth

Seth Spearman
Yes, the data is from a database, unfortunately, the data is not really in a grid format. On a line, I can have a block with a width corresponding to 2 hours and on anoter line, I have a block for 1.80 hour.
Mathieu Pagé
A: 

Sounds like a TimeLine control, heres a screenshot of one. Id buy one, rather then write one. Devexpress are expensive, but very good. Im sure if you research, you can find a free one.

Screenshot at DevExpress

Mike D