예제 #1
0
        private void VerticalGuideBtn_Click(object sender, RoutedEventArgs e)
        {
            VerticalRuler V = new VerticalRuler();

            V.Height = 2000;
            V.ManipulationStarted   += Ruler_ManipulationStarted;
            V.ManipulationCompleted += Ruler_ManipulationCompleted;
            V.ManipulationDelta     += Ruler_ManipulationDelta;
            V.ManipulationMode       = ManipulationModes.TranslateX;
            V.PointerEntered        += Ruler_PointerEntered;
            V.PointerExited         += Ruler_PointerExited;
            DrawCanvas.Children.Add(V);
            Canvas.SetLeft(V, 120);
        }
예제 #2
0
 private void Ruler_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     if (IsGuideDragging)
     {
         if (sender.GetType() == typeof(VerticalRuler))
         {
             VerticalRuler V = sender as VerticalRuler;
             Canvas.SetLeft(V, Canvas.GetLeft(V) + e.Delta.Translation.X);
         }
         else if (sender.GetType() == typeof(HorizontalRuler))
         {
             HorizontalRuler H = sender as HorizontalRuler;
             Canvas.SetTop(H, Canvas.GetTop(H) + e.Delta.Translation.Y);
         }
     }
 }