当前位置: 首页>>代码示例>>C#>>正文


C# GestureEventArgs.GetPosition方法代码示例

本文整理汇总了C#中Microsoft.Phone.Controls.GestureEventArgs.GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# GestureEventArgs.GetPosition方法的具体用法?C# GestureEventArgs.GetPosition怎么用?C# GestureEventArgs.GetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Phone.Controls.GestureEventArgs的用法示例。


在下文中一共展示了GestureEventArgs.GetPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: imgResult_Tap

        private void imgResult_Tap(object sender, GestureEventArgs e)
        {
            //Si premier clic, on enrgistre le X et le Y
            if (clic1)
            {
                tmp.X = Convert.ToInt32(e.GetPosition(imgResult).X);
                tmp.Y = Convert.ToInt32(e.GetPosition(imgResult).Y);

                //On affiche le premier point
                e1.Margin = new Thickness(tmp.X, tmp.Y, 0, 0);
                e1.Visibility = Visibility.Visible;

                clic1 = false;
                clic2 = true;

                return;
            }

            //Si second clic, on enregistre longeur et largeur
            if (clic2)
            {
                //Longueur
                int x = Convert.ToInt32(e.GetPosition(imgResult).X);

                if (tmp.X > x)
                {
                    MessageBox.Show("This point should be the corner on the down right", "Error", MessageBoxButton.OK);
                }
                else
                {
                    tmp.Longueur = x - tmp.X;
                    int y = Convert.ToInt32(e.GetPosition(imgResult).Y);

                    if (tmp.Y > y)
                    {
                        MessageBox.Show("This point should be the corner on the down right", "Error", MessageBoxButton.OK);
                    }
                    else
                    {
                        tmp.Hauteur = y - tmp.Y;
                        clic2 = false;

                        //On enlève l'ellipse
                        e1.Visibility = Visibility.Collapsed;

                        //On affiche le rectable
                        r1.Margin = new Thickness(e1.Margin.Left + 10, e1.Margin.Top +6,0,0);
                        r1.Width = tmp.Longueur;
                        r1.Height = tmp.Hauteur;
                        r1.Visibility = Visibility.Visible;

                        //On choisit l'objet
                        objet = true;
                        ContentPanelItem.Visibility = Visibility.Visible;
                    }
                }
            }
        }
开发者ID:Branlute,项目名称:victor,代码行数:58,代码来源:Editor.xaml.cs

示例2: Border_Tap

        private void Border_Tap(object sender, GestureEventArgs e)
        {
            //determine the click location
            var pos = e.GetPosition(_border);

            // forward to the browser
            _browser.InvokeScript("eval",
              string.Format("document.elementFromPoint({0},{1}).click()", pos.X, pos.Y));
        }
开发者ID:stevepotayteo,项目名称:sgpromotions,代码行数:9,代码来源:BrowserFastClick.cs

示例3: GestureListener_Hold

 private void GestureListener_Hold(object sender, GestureEventArgs e)
 {
     if (ok == false)
     {
         ok = true;
         var pushPin = new Pushpin();
         var position = e.GetPosition(map1);
         var location = map1.ViewportPointToLocation(position);
         thisApp.Lat = (decimal)location.Latitude;
         thisApp.Long = (decimal)location.Longitude;
         PushpinLayer.AddChild(pushPin, location);
     }
 }
开发者ID:evelinad,项目名称:TaskNotifier,代码行数:13,代码来源:ViewMap.xaml.cs

示例4: OnTap

        private void OnTap(object sender, GestureEventArgs e)
        {
            Point p = e.GetPosition(flipControl);

            if (flipControl.IsFlipped)
            {
                flipControl.FlipDirection = (p.X > flipControl.ActualWidth / 2.0) ? FlipDirection.Backwards : FlipDirection.Forwards;
            }
            else
            {
                flipControl.FlipDirection = (p.X < flipControl.ActualWidth / 2.0) ? FlipDirection.Backwards : FlipDirection.Forwards;
            }

            flipControl.IsFlipped = !flipControl.IsFlipped;
        }
开发者ID:luiseduardohdbackup,项目名称:dotnet-1,代码行数:15,代码来源:LearningGame.xaml.cs

示例5: map1_Tap

        void map1_Tap(object sender, GestureEventArgs e)
        {
            if (oneMarker != null)
            { 
                Point markPoint = map1.ConvertGeoCoordinateToViewportPoint(oneMarker.GeoCoordinate);

                if ((markPoint.X < 0 || markPoint.Y < 0)
                || (map1.ActualWidth < markPoint.X) || (map1.ActualHeight < markPoint.Y))
                {
                    // tap event when we do not have the marker visible, so lets move it here
                    oneMarker.GeoCoordinate = map1.ConvertViewportPointToGeoCoordinate(e.GetPosition(map1));
                    DoCreateTheAreaCircle();
                    if (twoMarker != null && PolyCircle != null && PolyCircle.Path != null)
                    {
                        twoMarker.GeoCoordinate = PolyCircle.Path[0];
                    }
                }
            }
        }
开发者ID:ZeynepCamurdan,项目名称:maps-samples,代码行数:19,代码来源:AreaSelectorPage.xaml.cs

示例6: Map_Hold

        void Map_Hold(object sender, GestureEventArgs e)
        {
            ClearQuery();
            Point2D point = myMap.ScreenToMap(e.GetPosition(myMap));
            double radius = 100000;//Map.Resolution * 10;
            Utility.Point2D p = new Utility.Point2D(point.X, point.Y);
            Utility.Geometry geometry = new Utility.Geometry();
            geometry.Type = Utility.GeometryType.POINT;
            geometry.Parts = new int[] { 1 };
            geometry.Points = new Utility.Point2D[1] { p };

            Utility.QueryParameterSet query = new Utility.QueryParameterSet();
            query.ReturnContent = true;
            query.ExpectCount = 1;
            query.QueryOption = Utility.QueryOption.ATTRIBUTEANDGEOMETRY;
            query.QueryParams = new Utility.QueryParameter[] { new Utility.QueryParameter("[email protected]") };

            _queryMap.FindNearest(mapName, geometry, radius, query,
                new EventHandler<Utility.QueryEventArgs>(Query_Completed), new EventHandler<Utility.FailedEventArgs>(Query_Failed));
        }
开发者ID:SuperMap,项目名称:iClient-DotNet-Example,代码行数:20,代码来源:MainPage.xaml.cs

示例7: gesture_Hold

 private void gesture_Hold(object sender, GestureEventArgs e)
 {
     var point = e.GetPosition(ContentPanel);
     message.Text = string.Format("hold at ({0},{1})", point.X, point.Y);
 }
开发者ID:shreedharcva,项目名称:Windows-Phone-7-In-Action,代码行数:5,代码来源:GestureListenerSample.xaml.cs

示例8: gesture_Tap

 private void gesture_Tap(object sender, GestureEventArgs e)
 {
     var point = e.GetPosition(ContentPanel);
     message.Text = string.Format("tap at ({0},{1})", point.X, point.Y);
     flickMessage.Text = null;
 }
开发者ID:shreedharcva,项目名称:Windows-Phone-7-In-Action,代码行数:6,代码来源:GestureListenerSample.xaml.cs

示例9: OnPreviewTap

        /// <summary>
        /// <see cref="UIElement.Tap"/> event handler.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">The <see cref="GestureEventArgs"/> instance containing the event data.</param>
        private void OnPreviewTap(object sender, GestureEventArgs e)
        {
            Point pointOnPreview = e.GetPosition(this.LivePreview);

            // Don't notify about touches made close to the edges.
            if (pointOnPreview.X < this.TapBoundary || pointOnPreview.X > this.LivePreview.Width - this.TapBoundary
                || pointOnPreview.Y < this.TapBoundary || pointOnPreview.Y > this.PreviewHeight - this.TapBoundary)
            {
                return;
            }

            Point positionPercentage = new Point(pointOnPreview.X / this.LivePreview.ActualWidth, pointOnPreview.Y / this.LivePreview.ActualHeight);

            // We flip preview's X-axis for the front-facing camera.
            if (this.cameraType == CameraType.FrontFacing)
            {
                positionPercentage.X = 1.0 - positionPercentage.X;
            }

            EventHandler<PreviewTapLocationEventArgs> handler = this.PreviewTap;
            if (handler != null)
            {
                handler.Invoke(this, new PreviewTapLocationEventArgs(positionPercentage));
            }
        }
开发者ID:trilok567,项目名称:Windows-Phone,代码行数:30,代码来源:Viewfinder.xaml.cs

示例10: LayoutRoot_Tap

 private void LayoutRoot_Tap(object sender, GestureEventArgs e)
 {
     Point p = e.GetPosition(null);
     MessageBox.Show(string.Format("X = {0}, Y = {1}", p.X, p.Y));
 }
开发者ID:jiangxianliang,项目名称:SmartCampusAAU,代码行数:5,代码来源:UI_OfflineGoogleMap.xaml.cs

示例11: BingMap_Tap

		/// <summary>
		/// Occurs when the user taps on the map.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void BingMap_Tap(object sender, GestureEventArgs e)
		{
			if (_pin == null)
			{
				// Drop a pushpin representing the pin.
				_pin = new Pushpin();
				_pin.Template = Resources["PinPushpinTemplate"] as ControlTemplate;
				BingMap.Children.Add(_pin);
			}

			// Determine the coordinates of the point that was tapped.
			var point = e.GetPosition(BingMap);
			var newPinLocation = BingMap.ViewportPointToLocation(point);

			// Update pin's location and the distance to me.
			_pin.Location = newPinLocation;
			ViewModel.Pin = newPinLocation;
			ViewModel.UpdateDistance();
		}
开发者ID:Tiger66639,项目名称:Windows-Phone-Porting-Samples,代码行数:24,代码来源:MainPage.xaml.cs

示例12: listener_Hold

        void listener_Hold(object sender, GestureEventArgs e)
        {
            ((MenuItem)menu.Items[0]).Header = "Identifying Location...";
            menu.IsOpen = true;

            System.Device.Location.GeoCoordinate location = this.BingMap.ViewportPointToLocation(e.GetPosition(this.BingMap));

            MobileSrc.Services.GeocodeServices.GeocodeServiceClient rclient = new MobileSrc.Services.GeocodeServices.GeocodeServiceClient("BasicHttpBinding_IGeocodeService");
            MobileSrc.Services.GeocodeServices.ReverseGeocodeRequest req = new MobileSrc.Services.GeocodeServices.ReverseGeocodeRequest();
            req.Credentials = new MobileSrc.Services.GeocodeServices.Credentials();
            req.Credentials.ApplicationId = BingMapsApiKey;
            req.Location = new MobileSrc.Services.GeocodeServices.Location();
            req.Location.Latitude = location.Latitude;
            req.Location.Longitude = location.Longitude;
            req.ExecutionOptions = new MobileSrc.Services.GeocodeServices.ExecutionOptions();

            rclient.ReverseGeocodeCompleted += new EventHandler<MobileSrc.Services.GeocodeServices.ReverseGeocodeCompletedEventArgs>(client_ReverseGeocodeCompleted);
            rclient.ReverseGeocodeAsync(req);
        }
开发者ID:nbclark,项目名称:commuter,代码行数:19,代码来源:RouteEditor.xaml.cs

示例13: LayoutRoot_Tap

        private void LayoutRoot_Tap(object sender, GestureEventArgs e)
        {
            this.LayoutRoot.Tap -= LayoutRoot_Tap;

            this.PlayAudioFile("ThrowAudio.wav");

            Image tomatoImage = new Image();
            tomatoImage.Source = new BitmapImage(new Uri("tomato.png", UriKind.RelativeOrAbsolute));
            tomatoImage.Height = 74;
            tomatoImage.Width = 63;
            TomatoRedirection(tomatoImage);
            _tomatoImages.Add(tomatoImage);

            LayoutRoot.Children.Add(tomatoImage);

            System.Windows.Point tappedHere = e.GetPosition(this.LayoutRoot);
            _tappedPoints.Add(tappedHere);
            _tapCount++;

            // Create a duration of 0.5 seconds.
            Duration duration = new Duration(TimeSpan.FromMilliseconds(400));

            // Create two DoubleAnimations and set their properties.
            DoubleAnimation myDoubleAnimation1 = new DoubleAnimation();
            DoubleAnimation myDoubleAnimation2 = new DoubleAnimation();

            myDoubleAnimation1.Duration = duration;
            myDoubleAnimation2.Duration = duration;

            Storyboard sb = new Storyboard();
            sb.Duration = duration;

            sb.Children.Add(myDoubleAnimation1);
            sb.Children.Add(myDoubleAnimation2);

            Storyboard.SetTarget(myDoubleAnimation1, tomatoImage);
            Storyboard.SetTarget(myDoubleAnimation2, tomatoImage);

            // Set the attached properties of Canvas.Left and Canvas.Top
            // to be the target properties of the two respective DoubleAnimations.
            Storyboard.SetTargetProperty(myDoubleAnimation1, new PropertyPath("(Canvas.Left)"));
            Storyboard.SetTargetProperty(myDoubleAnimation2, new PropertyPath("(Canvas.Top)"));

            myDoubleAnimation1.To = tappedHere.X;//widhth 63
            myDoubleAnimation2.To = tappedHere.Y; //Height 74

            ScaleTransform scale = new ScaleTransform();
            tomatoImage.RenderTransformOrigin = new System.Windows.Point(0.5, 0.5);
            tomatoImage.RenderTransform = scale;

            DoubleAnimation growAnimationX = new DoubleAnimation();
            growAnimationX.Duration = TimeSpan.FromMilliseconds(300);
            growAnimationX.From = 5;
            growAnimationX.To = 1;

            DoubleAnimation growAnimationY = new DoubleAnimation();
            growAnimationY.Duration = TimeSpan.FromMilliseconds(300);
            growAnimationY.From = 5;
            growAnimationY.To = 1;

            Storyboard.SetTargetProperty(growAnimationX, new PropertyPath("(Image.RenderTransform).(ScaleTransform.ScaleX)"));
            Storyboard.SetTarget(growAnimationX, tomatoImage);

            Storyboard.SetTargetProperty(growAnimationY, new PropertyPath("(Image.RenderTransform).(ScaleTransform.ScaleY)"));
            Storyboard.SetTarget(growAnimationY, tomatoImage);

            sb.Children.Add(growAnimationX);
            sb.Children.Add(growAnimationY);

            // Begin the animation.
            sb.Begin();

            sb.Completed += new EventHandler(sb_Completed);
        }
开发者ID:thakkar,项目名称:Tomatoes,代码行数:74,代码来源:MainPage.xaml.cs

示例14: gestureListener_DoubleTap

        private void gestureListener_DoubleTap(object sender, GestureEventArgs e)
        {
            if (imageMan == null)
                return;

            Point p = e.GetPosition(image);
            if (zoomed)
            {
                zoomed = false;
                ApplyZoomTransform(sender as Image, 1, p);
            }
            else
            {
                zoomed = true;
                ApplyZoomTransform(sender as Image, zoomFactor, p);
            }
        }
开发者ID:ahmetalpbalkan,项目名称:colorify,代码行数:17,代码来源:MainPage.xaml.cs

示例15: OnMyCameraMediaElementTapped

    /// <summary>
    /// Changes the current camera effect.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private async void OnMyCameraMediaElementTapped(object sender, GestureEventArgs e) {
      var uiTapPoint = e.GetPosition(_mediaElement);
      if (_focusSemaphore.WaitOne(0)) {
        // Get tap coordinates as a foundation point
        var tapPoint = new Windows.Foundation.Point(uiTapPoint.X, uiTapPoint.Y);

        
        // adjust to center focus on the tap point
        var displayOrigin = new Windows.Foundation.Point(
            tapPoint.X - _focusRegionSize.Width / 2,
            tapPoint.Y - _focusRegionSize.Height / 2);

        // adjust for resolution difference between preview image and the canvas
        var viewFinderOrigin = new Windows.Foundation.Point(displayOrigin.X , displayOrigin.Y);
        var focusrect = new Windows.Foundation.Rect(viewFinderOrigin, _focusRegionSize);

        // clip to preview resolution
        var viewPortRect = new Windows.Foundation.Rect(0, 0,_camera.PreviewResolution.Width,_camera.PreviewResolution.Height);
        focusrect.Intersect(viewPortRect);

       _camera.FocusRegion = focusrect;

        // show a focus indicator
        FocusIndicator.Margin = new Thickness(uiTapPoint.X - (_focusRegionSize.Width/2), uiTapPoint.Y - (_focusRegionSize.Height/2), 0, 0);
        FocusIndicator.SetValue(Shape.StrokeProperty, _notFocusedBrush);
        FocusIndicator.SetValue(Canvas.VisibilityProperty, Visibility.Visible);

        CameraFocusStatus status = await _camera.FocusAsync();
        if (status == CameraFocusStatus.Locked) {
          FocusIndicator.SetValue(Shape.StrokeProperty, _focusedBrush);
          _manuallyFocused = true;
         _camera.SetProperty(KnownCameraPhotoProperties.LockedAutoFocusParameters,
              AutoFocusParameters.Exposure & AutoFocusParameters.Focus & AutoFocusParameters.WhiteBalance);
        } else {
          _manuallyFocused = false;
         _camera.SetProperty(KnownCameraPhotoProperties.LockedAutoFocusParameters, AutoFocusParameters.None);
        }
        _focusSemaphore.Release();
      }
    }
开发者ID:rolkun,项目名称:WP8Kochbuch,代码行数:45,代码来源:LensePage.xaml.cs


注:本文中的Microsoft.Phone.Controls.GestureEventArgs.GetPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。