當前位置: 首頁>>代碼示例>>C#>>正文


C# Input.ManipulationDeltaEventArgs類代碼示例

本文整理匯總了C#中System.Windows.Input.ManipulationDeltaEventArgs的典型用法代碼示例。如果您正苦於以下問題:C# ManipulationDeltaEventArgs類的具體用法?C# ManipulationDeltaEventArgs怎麽用?C# ManipulationDeltaEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ManipulationDeltaEventArgs類屬於System.Windows.Input命名空間,在下文中一共展示了ManipulationDeltaEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnManipulationDelta

        void OnManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            if (e.PinchManipulation != null)
            {
                e.Handled = true;

                if (!_pinching)
                {
                    _pinching = true;
                    Point center = e.PinchManipulation.Original.Center;
                    _relativeMidpoint = new Point(center.X / SystemMapImage.ActualWidth, center.Y / SystemMapImage.ActualHeight);

                    var xform = SystemMapImage.TransformToVisual(ImageViewPort);
                    _screenMidpoint = xform.Transform(center);
                }

                _scale = _originalScale * e.PinchManipulation.CumulativeScale;

                CoerceScale(false);
                ResizeImage(false);
            }
            else if (_pinching)
            {
                _pinching = false;
                _originalScale = _scale = _coercedScale;
            }
        }
開發者ID:CodeObsessed,項目名稱:drumbleapp,代碼行數:27,代碼來源:Maps.xaml.cs

示例2: ImageGrid_ManipulationDelta

        private void ImageGrid_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            if (e.PinchManipulation != null)
            {
                //縮放
                _bokehManger.ScaleChange(e.PinchManipulation.DeltaScale);

                _bokehManger.RotationChange(e.PinchManipulation.Current, e.PinchManipulation.Original);

                TouchPanel.EnabledGestures = GestureType.None;
            }
            else
            {
                while (TouchPanel.IsGestureAvailable)
                {
                    GestureSample sample = TouchPanel.ReadGesture();
                    Point sampleDelta = new Point(sample.Delta.X, sample.Delta.Y);
                    _bokehManger.PositionChange(sampleDelta);
                }
                if (!TouchPanel.IsGestureAvailable)
                {
                    _bokehManger.SetPreAngel();
                }
            }
            _bokehManger.SetGradient();
        }
開發者ID:onionstyle,項目名稱:BokehDemo,代碼行數:26,代碼來源:MainPage.xaml.cs

示例3: negro_ManipulationDelta_1

 // Al arrastrar el circulo.
 private void negro_ManipulationDelta_1(object sender, ManipulationDeltaEventArgs e)
 {
     FrameworkElement elipse = sender as FrameworkElement;
     elipse.RenderTransform = dragTranslation;
     dragTranslation.TranslateX = dragTranslation.TranslateX + e.DeltaManipulation.Translation.X;
     dragTranslation.TranslateY = dragTranslation.TranslateY + e.DeltaManipulation.Translation.Y;
 }
開發者ID:jacevedo,項目名稱:Windows-Phone,代碼行數:8,代碼來源:MainPage.xaml.cs

示例4: OnManipulationDelta

 private void OnManipulationDelta(object Sender, ManipulationDeltaEventArgs DeltaRoutedEventArgs)
 {
     if (DeltaRoutedEventArgs.CumulativeManipulation.Translation.X < -30)
     {
         _gameGrid.HandleMove(MoveDirection.Left);
         DeltaRoutedEventArgs.Complete();
         DeltaRoutedEventArgs.Handled = true;
     }
     else if (DeltaRoutedEventArgs.CumulativeManipulation.Translation.X > 30)
     {
         _gameGrid.HandleMove(MoveDirection.Right);
         DeltaRoutedEventArgs.Complete();
         DeltaRoutedEventArgs.Handled = true;
     }
     else if (DeltaRoutedEventArgs.CumulativeManipulation.Translation.Y < -30)
     {
         _gameGrid.HandleMove(MoveDirection.Up);
         DeltaRoutedEventArgs.Complete();
         DeltaRoutedEventArgs.Handled = true;
     }
     else if (DeltaRoutedEventArgs.CumulativeManipulation.Translation.Y > 30)
     {
         _gameGrid.HandleMove(MoveDirection.Down);
         DeltaRoutedEventArgs.Complete();
         DeltaRoutedEventArgs.Handled = true;
     }
 }
開發者ID:andrecurvello,項目名稱:2048,代碼行數:27,代碼來源:MainPage.xaml.cs

示例5: OnManipulationDelta

        protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
        {
            Card element = e.Source as Card;
            ManipulationDelta delta = e.DeltaManipulation;
            Point center = e.ManipulationOrigin;
            Matrix matrix = new Matrix();
            if (STATICS.MIN_CARD_SCALE < element.CurrentScale * delta.Scale.X && element.CurrentScale * delta.Scale.X < STATICS.MAX_CARD_SCALE)
            {
                element.CurrentScale = element.CurrentScale * delta.Scale.X;
                matrix.Scale(element.CurrentScale, element.CurrentScale);
            }
            else
            {
                matrix.Scale(element.CurrentScale, element.CurrentScale);
            }
            element.CurrentPosition = new Point(element.CurrentPosition.X + delta.Translation.X, element.CurrentPosition.Y + delta.Translation.Y);
            element.CurrentRotation += delta.Rotation;

            matrix.Rotate(element.CurrentRotation);
            matrix.Translate(element.CurrentPosition.X, element.CurrentPosition.Y);

            element.RenderTransform = new MatrixTransform(matrix);

            mainWindow.LinkingGestureLayer.Move(element);
            e.Handled = true;
            base.OnManipulationDelta(e);
        }
開發者ID:nius1989,項目名稱:CardDesign_TechSnack,代碼行數:27,代碼來源:Card_Layer.xaml.cs

示例6: Border_ManipulationDelta

 private void Border_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
 {
     // suppress zoom
     if (e.DeltaManipulation.Scale.X != 0.0 ||
         e.DeltaManipulation.Scale.Y != 0.0)
         e.Handled = true;
 }
開發者ID:timextreasures,項目名稱:WordPress-WindowsPhone,代碼行數:7,代碼來源:LicensesPage.xaml.cs

示例7: cropArea_ManipulationDelta

        private void cropArea_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            /**
             *  all of this code keeps the picture within the boundaries
             */

            drag.Y += e.DeltaManipulation.Translation.Y;
            if (drag.Y < 0)
                drag.Y = 0;
            if (drag.Y > max)
                drag.Y = max;

            int temp = current + (int)e.DeltaManipulation.Translation.Y;
            if (temp < min)
            {
                lowerBound.Height = originalPhoto.Height - cropArea.Height;
                upperBound.Height = 0;
                current = min;
            }
            else if (temp > max)
            {
                upperBound.Height = originalPhoto.Height - cropArea.Height;
                lowerBound.Height = 0;
                current = max;
            }
            else
            {
                upperBound.Height = temp;
                lowerBound.Height = max - temp;
                current = temp;
            }
        }
開發者ID:purdue-cs-groups,項目名稱:cs307-project01,代碼行數:32,代碼來源:CropPage.xaml.cs

示例8: Element_ManipulationDelta

        private void Element_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            if (!IsEnabled)
            return;

              if (!IsActive)
              {
            // has the user dragged far enough?
            if (Math.Abs(e.CumulativeManipulation.Translation.X) < DragStartedDistance)
              return;

            IsActive = true;

            // initialize the drag
            FrameworkElement fe = sender as FrameworkElement;
            fe.SetHorizontalOffset(0);

            // find the container for the tick and cross graphics
            _tickAndCrossContainer = fe.Descendants()
                                   .OfType<FrameworkElement>()
                                   .Single(i => i.Name == "tickAndCross");
              }
              else
              {
            // handle the drag to offset the element
            FrameworkElement fe = sender as FrameworkElement;
            double offset = fe.GetHorizontalOffset().Value + e.DeltaManipulation.Translation.X;
            fe.SetHorizontalOffset(offset);

            _tickAndCrossContainer.Opacity = TickAndCrossOpacity(offset);
              }
        }
開發者ID:andersberglund,項目名稱:WP7-ClearStyle,代碼行數:32,代碼來源:SwipeInteraction.cs

示例9: cropArea_ManipulationDelta

        private void cropArea_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            drag.X += e.DeltaManipulation.Translation.X;
            if (drag.X < 0)
                drag.X = 0;
            if (drag.X > max)
                drag.X = max;

            int temp = current + (int)e.DeltaManipulation.Translation.X;
            if (temp < min)
            {
                rightBound.Width = originalPhoto.Width - cropArea.Width;
                leftBound.Width = 0;
                current = min;
            }
            else if (temp > max)
            {
                leftBound.Width = originalPhoto.Width - cropArea.Width;
                rightBound.Width = 0;
                current = max;
            }
            else
            {
                leftBound.Width = temp;
                rightBound.Width = max - temp;
                current = temp;
            }
        }
開發者ID:purdue-cs-groups,項目名稱:cs307-project01,代碼行數:28,代碼來源:CropPageLandscapeOrientation.xaml.cs

示例10: image_ManipulationDelta

        private void image_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            // Get the image that's being manipulated.            
            FrameworkElement element = (FrameworkElement)e.Source;

            // Use the matrix to manipulate the element.
            Matrix matrix = ((MatrixTransform)element.RenderTransform).Matrix;

            var deltaManipulation = e.DeltaManipulation;
            // Find the old center, and apply the old manipulations.
            Point center = new Point(element.ActualWidth / 2, element.ActualHeight / 2);
            center = matrix.Transform(center);

            // Apply zoom manipulations.
            matrix.ScaleAt(deltaManipulation.Scale.X, deltaManipulation.Scale.Y, center.X, center.Y);

            // Apply rotation manipulations.
            matrix.RotateAt(e.DeltaManipulation.Rotation, center.X, center.Y);

            // Apply panning.
            matrix.Translate(e.DeltaManipulation.Translation.X, e.DeltaManipulation.Translation.Y);

            // Set the final matrix.
            ((MatrixTransform)element.RenderTransform).Matrix = matrix;

        }
開發者ID:ittray,項目名稱:LocalDemo,代碼行數:26,代碼來源:Manipulations.xaml.cs

示例11: StackPanel_ManipulationDelta

 private void StackPanel_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
 {
     /* if (e.DeltaManipulation.Translation.Y != 0)
          return;
      if (Event != null)
          Event(this, e);*/
 }
開發者ID:klyuchnikov,項目名稱:SystemMonitoringForTheLearningProcess,代碼行數:7,代碼來源:StatisticGroupViewControl.xaml.cs

示例12: Border_ManipulationDelta

        private void Border_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            if (Math.Abs(e.DeltaManipulation.Translation.X) > Math.Abs(e.DeltaManipulation.Translation.Y))
                e.Handled = true;

            if (e.CumulativeManipulation.Scale.X != 0.0 || e.CumulativeManipulation.Scale.Y != 0.0)
                e.Handled = true;
        }
開發者ID:jlopresti,項目名稱:TouchWebBrowserDecorator,代碼行數:8,代碼來源:TouchWebBrowserDecorator.cs

示例13: OnManipulationDelta

        protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
        {
            base.OnManipulationDelta(e);

            TransformMap(e.ManipulationOrigin,
                (Point)e.DeltaManipulation.Translation, e.DeltaManipulation.Rotation,
                (e.DeltaManipulation.Scale.X + e.DeltaManipulation.Scale.Y) / 2d);
        }
開發者ID:bhanu475,項目名稱:XamlMapControl,代碼行數:8,代碼來源:Map.WPF.cs

示例14: ManipulationDelta

        public void ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            Manipulation(e);

            updateUserCursor();

            SetMarkers();
            e.Handled = true;
        }
開發者ID:gdlprj,項目名稱:duscusys,代碼行數:9,代碼來源:VdArrow.cs

示例15: OnManipulationDelta

        protected override void OnManipulationDelta(ManipulationDeltaEventArgs args)
        {
            if (!manipulationDeltaInProgress)
            {
                IsActive = true;

                if (!tapInertiaInProgess)
                    SelectedIndex = -1;
            }

            manipulationDeltaInProgress = true;

            // This is the fake inertia from a tap
            if (tapInertiaInProgess)
            {
                VerticalOffset -= args.DeltaManipulation.Translation.Y;
            }

            // All other direct manipulation and inertia
            else
            {
                // For non-wrappable panel, check for end of the line
                if (!isWrappableStackPanel)
                {
                    double newVerticalOffset = VerticalOffset - inertiaDirection * args.DeltaManipulation.Translation.Y;

                    if (FractionalCenteredIndexFromVerticalOffset(newVerticalOffset, false) < 0)
                    {
                        double verticalOffsetIncrement = VerticalOffset - VerticalOffsetFromCenteredIndex(0);
                        double verticalOffsetExcess = args.DeltaManipulation.Translation.Y - verticalOffsetIncrement;
                        VerticalOffset -= verticalOffsetIncrement;
                        SelectedIndex = 0;
                        args.ReportBoundaryFeedback(new ManipulationDelta(new Vector(0, verticalOffsetExcess), 0, new Vector(), new Vector()));
                        args.Complete();
                    }
                    else if (FractionalCenteredIndexFromVerticalOffset(newVerticalOffset, false) > Items.Count - 1)
                    {
                        double verticalOffsetIncrement = VerticalOffsetFromCenteredIndex(Items.Count - 1) - VerticalOffset;
                        double verticalOffsetExcess = args.DeltaManipulation.Translation.Y - verticalOffsetIncrement;
                        VerticalOffset += verticalOffsetIncrement;
                        SelectedIndex = Items.Count - 1;
                        args.ReportBoundaryFeedback(new ManipulationDelta(new Vector(0, verticalOffsetExcess), 0, new Vector(), new Vector()));
                        args.Complete();
                    }
                }

                // Here's where scrolling might reverse itself
                if (args.IsInertial && inertiaToUnknownIndex && !reverseInertiaChecked)
                    CheckForBackupManeuver(VerticalOffset, args.DeltaManipulation.Translation.Y, args.Velocities.LinearVelocity.Y);

                // This is the normal direct manipulation and inertia
                VerticalOffset -= inertiaDirection * args.DeltaManipulation.Translation.Y;
            }

            base.OnManipulationDelta(args);
        }
開發者ID:BoonieBear,項目名稱:TinyMetro,代碼行數:56,代碼來源:WindowedItemsControl.Manipulation.cs


注:本文中的System.Windows.Input.ManipulationDeltaEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。