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);
      }

 

Leave a Reply