11013 : I want to increase and decrease the date scaler resolution manually on some buttons. Hows this possible… ?

Question

Hello support,

    I want to increase and decrease the date scaler resolution manually on some buttons. How’s this possible… ? It will help me if you provide the code.

Answer

private void ZoomMinus_Click(object sender, System.EventArgs e)
{
        gantt1.DateScaler.StartTime=gantt1.DateScaler.StartTime.AddDays(2);
        gantt1.DateScaler.StopTime=gantt1.DateScaler.StopTime.AddDays(-2);
}

private void ZoomPlus_Click(object sender, System.EventArgs e)
{
        gantt1.DateScaler.StartTime=gantt1.DateScaler.StartTime.AddDays(-2);
        gantt1.DateScaler.StopTime=gantt1.DateScaler.StopTime.AddDays(2);
}

This way we do it in Gantt_ASP, and it works better because it always zooms half of the span, no matter the current resolution…

      if (eventArgument == “scaleinc”)
      {
        TimeSpan ts=StopTime.Subtract(StartTime);
        ts=new TimeSpan(ts.Ticks/4);
       
        StartTime=StartTime.Subtract(ts);
        StopTime=StopTime.Add(ts);
      }
      else
      if (eventArgument == “scaledec”)
      {
        TimeSpan ts=StopTime.Subtract(StartTime);
        ts=new TimeSpan(ts.Ticks/4);
       
        StartTime=StartTime.Add(ts);
        StopTime=StopTime.Subtract(ts);
      }

 

10029 : disable clicking and dragging on the heading to adjust the zoom level of the Gantt chart?

Question

Can you disable clicking and dragging on the heading to adjust the zoom level of the Gantt chart?

We would need more control over the zoom level in the Gantt chart.

Answer

The event DateScaler.OnBeforeScaleOrSpanChange has been added for this purpose. The event Fires whenever the scale or shown intervall is changed by user interaction.

Example to stop panoration and zooming could look like this:

    private void dateScaler1_OnBeforeScaleOrSpanChange(PlexityHide.GTP.DateScaler dateScaler, PlexityHide.GTP.BeforeScaleOrSpanChangeArgs e)< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

    {

      if (e.IsZoom && cbStopZooming.Checked)

      {

        e.NewStartTime=dateScaler1.StartTime; // Set new values back to current

        e.NewStopTime=dateScaler1.StopTime;

      }

 

      if (!e.IsZoom && cbStopPan.Checked)

      {

        e.NewStartTime=dateScaler1.StartTime; // Set new values back to current

        e.NewStopTime=dateScaler1.StopTime;

      }       

    }

 

Note: At publication date a patch download must be downloaded to access this new event.