示例#1
0
        private void HorizontalGuideBtn_Click(object sender, RoutedEventArgs e)
        {
            HorizontalRuler H = new HorizontalRuler();

            H.Width = 2000;
            H.ManipulationStarted   += Ruler_ManipulationStarted;
            H.ManipulationCompleted += Ruler_ManipulationCompleted;
            H.ManipulationDelta     += Ruler_ManipulationDelta;
            H.ManipulationMode       = ManipulationModes.TranslateY;
            H.PointerEntered        += Ruler_PointerEntered;
            H.PointerExited         += Ruler_PointerExited;
            DrawCanvas.Children.Add(H);
            Canvas.SetTop(H, 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);
         }
     }
 }