PlexityHide

Home 

Products 

Downloads 

Our Shop 

Support 

Contact 


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.

image 

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.

Like this:

image

And the code that does the trick:

   1: private void button1_Click(object sender, EventArgs e)
   2: {
   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);
   9: }
  10:  
  11: void Grid_Resize(object sender, EventArgs e)
  12: {
  13:     //... and update position if we are hi-jacked that is
  14:     if (gantt1.Grid.ScrollbarNodes.Parent == panelToHoldScroller)
  15:     {
  16:         gantt1.Grid.ScrollbarNodes.Top = 0;
  17:         gantt1.Grid.ScrollbarNodes.Left = 0;
  18:     }
  19:  
  20: }

Comments:
Nice idea, but I did it without pannel and resize...

Gantt.Grid.ScrollbarNodes.Parent = Gantt.TimeItemArea;
Gantt.Grid.ScrollbarNodes.Dock = DockStyle.Right;
 

Post a Comment

Subscribe to Post Comments [Atom]





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]

Support

Support intro

Knowledgebase

FAQ phGantTimePackage

FAQ GTP.NET

FAQ general

History