Beispiel #1
0
        private void initImage()
        {
            double           i  = 30;
            GeneralTransform gt = ImgBefore.TransformToVisual(null);
            Point            pt = gt.TransformPoint(new Point(0, 0));
            var _rect           = new RectangleGeometry();

            var point = new Point(i, 0);

            _rect.Rect                 = new Rect(point, new Size(ImgBefore.ActualWidth - i, ImgBefore.ActualHeight));
            ImgBefore.Clip             = _rect;
            Slider.HorizontalAlignment = HorizontalAlignment.Left;

            Slider.Margin = new Thickness((ImgAfter.ActualWidth - (ImgBefore.ActualWidth - i)) - 30, 0, 0, 0); // 30
        }
Beispiel #2
0
        private void Slider_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            try
            {
                var   ttv          = Slider.TransformToVisual(Window.Current.Content);
                Point screenCoords = ttv.TransformPoint(new Point(0, 0));
                if (((this.Transform.TranslateX + e.Delta.Translation.X) >= 0) && ((this.Transform.TranslateX + e.Delta.Translation.X) <= 950))
                {
                    this.Transform.TranslateX += e.Delta.Translation.X;

                    GeneralTransform gt = ImgBefore.TransformToVisual(null);
                    Point            pt = gt.TransformPoint(new Point(0, 0));
                    var _rect           = new RectangleGeometry();

                    var point = new Point(screenCoords.X - 300, 0);
                    _rect.Rect = new Rect(point, new Size(ImgBefore.ActualWidth - screenCoords.X + 300, ImgBefore.ActualHeight));

                    ImgBefore.Clip = _rect;
                }
            }
            catch (Exception ex)
            {
            }
        }