Wednesday, April 21, 2010
Stealing the scrollbar
If you want to have the scrollbar to the right of the time item area, you can achieve with very little effort.
In this samples I added some panels and gave them color so that they would be visible. The yellow panel to the right is were I want my scrollbar.
And the code that does the trick:
1: private void button1_Click(object sender, EventArgs e)
3: // Hi jack the Scrollbar to a new owner, and position it
4: gantt1.Grid.ScrollbarNodes.Parent = panelToHoldScroller;
5: gantt1.Grid.ScrollbarNodes.Top = 0;
6: gantt1.Grid.ScrollbarNodes.Left = 0;
7: // Catch all resize of the grid ...
8: gantt1.Grid.Resize += new EventHandler(Grid_Resize);
11: void Grid_Resize(object sender, EventArgs e)
13: //... and update position if we are hi-jacked that is
14: if (gantt1.Grid.ScrollbarNodes.Parent == panelToHoldScroller)
16: gantt1.Grid.ScrollbarNodes.Top = 0;
17: gantt1.Grid.ScrollbarNodes.Left = 0;
Nice idea, but I did it without pannel and resize...
Gantt.Grid.ScrollbarNodes.Parent = Gantt.TimeItemArea;
Gantt.Grid.ScrollbarNodes.Dock = DockStyle.Right;
Subscribe to Post Comments [Atom]
Subscribe to Posts [Atom]
Post a Comment