10057 : Zooming phGant

Question

Currently evaluating the PHGantTimePackage for VB6 and would like to know how you can zoom in and out programatically without having to drag the scaler left and right?

Answer

For starters you just set the Gantt.Start and Gantt.Stop to values of your liking and the view will adapt.

You can also use the function IphGantX3.AnimateScaleTransition(newScale,steps). The scale is basically a decimal value that is calculated by (Stop-Start)/WidthInPixels  So if you want to zoom out, to show more time, you can do Gantt.AnimateScaleTransition(Gantt.Scale*2,50). And to show less time Gantt.AnimateScaleTransition(Gantt.Scale/2,50)

To get a feel for the AnimateScaleTransition you can check the Gantt.Scale property… As you zoom this parameter changes. Zoom to year and check the value of Scale. Zoom to weeks and check the value of Scale.

Now add two buttons “Year” and “Weeks”, in each button you call AnimateScaleTransition(value,50) where value is the for year and weeks respectivly, You will see how to scale animates the transition from the current setting to the year or week setting in 50 steps.

 

Leave a Reply