Esempio n. 1
0
 // Zoom in or out (ie. change the visible time span): give a scale < 1.0
 // and it zooms in, > 1.0 and it zooms out.
 public void Zoom(double scale)
 {
     if (scale <= 0.0)
     {
         return;
     }
     grid.BeginDraw();
     if (VisibleTimeSpan.Scale(scale) > TotalTime)
     {
         var t = TimeSpan.FromTicks(TotalTime.Ticks / grid.Width);
         if (t.Ticks > 2000)
         {
             TimePerPixel     = t;
             VisibleTimeStart = TimeSpan.Zero;
         }
     }
     else
     {
         var t = TimePerPixel.Scale(scale);
         if (t.Ticks > 2000)
         {
             TimePerPixel = t;
             if (VisibleTimeEnd >= TotalTime)
             {
                 VisibleTimeStart = TotalTime - VisibleTimeSpan;
             }
         }
     }
     grid.EndDraw();
 }
Esempio n. 2
0
        public void ZoomTime(double scale, Point mousePosition)
        {
            if (scale <= 0.0)
            {
                return;
            }
            grid.BeginDraw();

            decimal  gridPixelWidth   = splitContainer.Panel2.Width;
            TimeSpan originalTimeSpan = VisibleTimeSpan;

            TimePerPixel = TimePerPixel.Scale(scale);
            TimeSpan newTimeSpan    = VisibleTimeSpan;
            decimal  timeSpanOffset = ((100 / gridPixelWidth) * (mousePosition.X - splitContainer.SplitterDistance) / 100);

            VisibleTimeStart = scale > 1
                                ? VisibleTimeStart - (pixelsToTime((int)(timeToPixels(newTimeSpan - originalTimeSpan) * (float)timeSpanOffset)))
                                : VisibleTimeStart + (pixelsToTime((int)(timeToPixels(originalTimeSpan - newTimeSpan) * (float)timeSpanOffset)));

            grid.EndDraw();
        }
Esempio n. 3
0
        // Zoom in or out (ie. change the visible time span): give a scale < 1.0
        // and it zooms in, > 1.0 and it zooms out.
        public void Zoom(double scale)
        {
            if (scale <= 0.0)
            {
                return;
            }

            if (VisibleTimeSpan.Scale(scale) > TotalTime)
            {
                TimePerPixel     = TimeSpan.FromTicks(TotalTime.Ticks / grid.Width);
                VisibleTimeStart = TimeSpan.Zero;
            }
            else
            {
                TimePerPixel = TimePerPixel.Scale(scale);
                if (VisibleTimeEnd > TotalTime)
                {
                    VisibleTimeStart = TotalTime - VisibleTimeSpan;
                }
            }
        }
 // Zoom in or out (ie. change the visible time span): give a scale < 1.0
 // and it zooms in, > 1.0 and it zooms out.
 public void Zoom(double scale)
 {
     if (scale <= 0.0)
     {
         return;
     }
     grid.BeginDraw();
     if (VisibleTimeSpan.Scale(scale) > TotalTime)
     {
         TimePerPixel     = TimeSpan.FromTicks(TotalTime.Ticks / grid.Width);
         VisibleTimeStart = TimeSpan.Zero;
     }
     else
     {
         TimePerPixel = TimePerPixel.Scale(scale);
         if (VisibleTimeEnd > TotalTime)
         {
             VisibleTimeStart = TotalTime - VisibleTimeSpan;
         }
     }
     grid.EndDraw();
     grid.ResetAllElements();
 }