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


C# PointerRoutedEventArgs.GetCurrentPoint方法代碼示例

本文整理匯總了C#中Windows.UI.Xaml.Input.PointerRoutedEventArgs.GetCurrentPoint方法的典型用法代碼示例。如果您正苦於以下問題:C# PointerRoutedEventArgs.GetCurrentPoint方法的具體用法?C# PointerRoutedEventArgs.GetCurrentPoint怎麽用?C# PointerRoutedEventArgs.GetCurrentPoint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Windows.UI.Xaml.Input.PointerRoutedEventArgs的用法示例。


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

示例1: Canvas_OnPointerReleased

		private void Canvas_OnPointerReleased(object sender, PointerRoutedEventArgs e)
		{
			var ptrId = e.GetCurrentPoint(sender as FrameworkElement).PointerId;
			if (e.GetCurrentPoint((Canvas)sender).Properties.PointerUpdateKind != PointerUpdateKind.Other)
			{
				ButtonPressTextBlock.Text = e.GetCurrentPoint((Canvas)sender).Properties.PointerUpdateKind.ToString();
			}
			if (_contacts.ContainsKey(ptrId))
			{
				_contacts[ptrId] = null;
				_contacts.Remove(ptrId);
			}
			e.Handled = true;
		}
開發者ID:robledop,項目名稱:Demos-20484,代碼行數:14,代碼來源:MainPage.xaml.cs

示例2: Scenario1OutputRoot_PointerReleased

 void Scenario1OutputRoot_PointerReleased(object sender, PointerRoutedEventArgs e)
 {
     uint ptrId = e.GetCurrentPoint(sender as FrameworkElement).PointerId;
     if (e.GetCurrentPoint(Scenario1OutputRoot).Properties.PointerUpdateKind != Windows.UI.Input.PointerUpdateKind.Other)
     {
         this.buttonPress.Text = e.GetCurrentPoint(Scenario1OutputRoot).Properties.PointerUpdateKind.ToString();
     }
     if (contacts.ContainsKey(ptrId))
     {
         contacts[ptrId] = null;
         contacts.Remove(ptrId);
         --numActiveContacts;
     }
     e.Handled = true;
 }
開發者ID:oldnewthing,項目名稱:old-Windows8-samples,代碼行數:15,代碼來源:Scenario1.xaml.cs

示例3: PlayArea_PointerPressed

        private void PlayArea_PointerPressed(object sender, PointerRoutedEventArgs e)
        {
            if (!_gameBoard.Interactable)
                return;

            if (_clickedPoint.Equals(EmptyPoint))
            {
             				_clickedPoint = e.GetCurrentPoint(PlayArea).Position;
                int row = (int)e.GetCurrentPoint(PlayArea).Position.Y / 60;
                int col = (int)e.GetCurrentPoint(PlayArea).Position.X / 60;

                _selectionSquare.Visibility = Visibility.Visible;
                _selectionSquare.SetValue(Canvas.LeftProperty, col * 60);
                _selectionSquare.SetValue(Canvas.TopProperty, row * 60);
            }
            else
            {
                int clickedRow = (int) _clickedPoint.Y/60;
                int clickedCol = (int) _clickedPoint.X/60;

                int row = (int) e.GetCurrentPoint(PlayArea).Position.Y/60;
                int col = (int) e.GetCurrentPoint(PlayArea).Position.X/60;
                _gameBoard.Swap(row, col, clickedRow, clickedCol);
                _clickedPoint = EmptyPoint;
                _selectionSquare.Visibility = Visibility.Collapsed;
            }
        }
開發者ID:roydor,項目名稱:BeCheweled,代碼行數:27,代碼來源:MainPage.xaml.cs

示例4: MyMapView_PointerMoved

		// HitTest the graphics and position the map tip
		private async void MyMapView_PointerMoved(object sender, PointerRoutedEventArgs e)
		{
			if (!_isMapReady)
				return;

			try
			{
				_isMapReady = false;

				Point screenPoint = e.GetCurrentPoint(MyMapView).Position;
				var graphic = await _graphicsLayer.HitTestAsync(MyMapView, screenPoint);
				if (graphic != null)
				{
					_mapTip.DataContext = graphic;
					_mapTip.Visibility = Visibility.Visible;
				}
				else
					_mapTip.Visibility = Visibility.Collapsed;
			}
			catch
			{
				_mapTip.Visibility = Visibility.Collapsed;
			}
			finally
			{
				_isMapReady = true;
			}
		}
開發者ID:MagicWang,項目名稱:arcgis-runtime-samples-dotnet,代碼行數:29,代碼來源:GraphicsMapTips.xaml.cs

示例5: Canvas_OnPointerMoved

		private void Canvas_OnPointerMoved(object sender, PointerRoutedEventArgs e)
		{
			var pt = e.GetCurrentPoint((Canvas)sender);
			var ptrId = pt.PointerId;
			if (pt.Properties.PointerUpdateKind != PointerUpdateKind.Other)
			{
				ButtonPressTextBlock.Text = pt.Properties.PointerUpdateKind.ToString();
			}

			if (_contacts.ContainsKey(ptrId) && _contacts[ptrId].HasValue)
			{
				var currentContact = pt.Position;
				var previousContact = _contacts[ptrId].Value;
				if (Distance(currentContact, previousContact) > 4)
				{
					var l = new Line
					{
						X1 = previousContact.X,
						Y1 = previousContact.Y,
						X2 = currentContact.X,
						Y2 = currentContact.Y,
						StrokeThickness = STROKETHICKNESS,
						Stroke = new SolidColorBrush(Colors.Red),
						StrokeEndLineCap = PenLineCap.Round
					};

					_contacts[ptrId] = currentContact;
					((Canvas)sender).Children.Add(l);
				}
			}

			e.Handled = true;
		}
開發者ID:robledop,項目名稱:Demos-20484,代碼行數:33,代碼來源:MainPage.xaml.cs

示例6: OnPointerPressed

        public void OnPointerPressed(InqCanvas inqCanvas, PointerRoutedEventArgs e)
        {
            Debug.WriteLine(e.Pointer.PointerDeviceType);
            _currentStroke = new PointCollection();
            _polyline = new Polyline
            {
                Stroke = new SolidColorBrush(StrokeColor),
                StrokeThickness = 3,
                StrokeLineJoin = PenLineJoin.Round
            };
            inqCanvas.Children.Add(_polyline);

            _polyline.Points = _currentStroke;

            var point = e.GetCurrentPoint(inqCanvas);

            _strokeBuilder.BeginStroke(point);
            _currentStroke.Add(point.Position);

            //_inkManager.

            /*
            //TODO: add data binding for thickness and color
            _currentStroke.StrokeThickness = Math.Max(4.0 * e.GetCurrentPoint(inqCanvas).Properties.Pressure, 2);
            _currentInqLineView.StrokeThickness = _currentStroke.StrokeThickness;
            inqCanvas.Children.Add(_currentInqLineView);
            var currentPoint = e.GetCurrentPoint(inqCanvas);
            _currentStroke.AddPoint(new Point(currentPoint.Position.X, currentPoint.Position.Y));
            */
        }
開發者ID:philllies,項目名稱:finalproject,代碼行數:30,代碼來源:DrawInqMode.cs

示例7: OnPointerPressed

 public static void OnPointerPressed(UIElement sender, TouchSliderC slider, PointerRoutedEventArgs e)
 {
     sender.CapturePointer(e.Pointer);
     _lastPoint = e.GetCurrentPoint(slider);
     _isDragActive = true;
     e.Handled = true;
 }
開發者ID:Mordrag,項目名稱:X-Air-Universal,代碼行數:7,代碼來源:TouchSliderCDragValueHandler.cs

示例8: uiElement_PointerMoved

        protected virtual void uiElement_PointerMoved(object sender, PointerRoutedEventArgs e)
        {
            if (moveD3dCanvas)
            {
                var newPosition = e.GetCurrentPoint(null);
                double deltaX = newPosition.Position.X - lastPos.Position.X;
                double deltaY = newPosition.Position.Y - lastPos.Position.Y;

                // Only support CompositeTransform and TranslateTransform
                // Is there any better way to handle this?
                if (uiElement.RenderTransform is CompositeTransform)
                {
                    var compositeTransform = (CompositeTransform)uiElement.RenderTransform;
                    compositeTransform.TranslateX += deltaX;
                    compositeTransform.TranslateY += deltaY;
                }
                else if (uiElement.RenderTransform is TranslateTransform)
                {
                    var translateTransform = (TranslateTransform)uiElement.RenderTransform;
                    translateTransform.X += deltaX;
                    translateTransform.Y += deltaY;
                }

                lastPos = newPosition;
            }
        }
開發者ID:MaybeMars,項目名稱:SharpDX-Samples,代碼行數:26,代碼來源:DragHandler.cs

示例9: Scenario1OutputRoot_PointerMoved

        void Scenario1OutputRoot_PointerMoved(object sender, PointerRoutedEventArgs e)
        {
            Windows.UI.Input.PointerPoint pt = e.GetCurrentPoint(Scenario1OutputRoot);
            uint ptrId = pt.PointerId;
            if (pt.Properties.PointerUpdateKind != Windows.UI.Input.PointerUpdateKind.Other)
            {
                this.buttonPress.Text = pt.Properties.PointerUpdateKind.ToString();
            }
            if (contacts.ContainsKey(ptrId) && contacts[ptrId].HasValue)
            {
                Point currentContact = pt.Position;
                Point previousContact = contacts[ptrId].Value;
                if (Distance(currentContact, previousContact) > 4)
                {
                    Line l = new Line()
                    {
                        X1 = previousContact.X,
                        Y1 = previousContact.Y,
                        X2 = currentContact.X,
                        Y2 = currentContact.Y,
                        StrokeThickness = STROKETHICKNESS,
                        Stroke = new SolidColorBrush(Colors.Red),
                        StrokeEndLineCap = PenLineCap.Round
                    };

                    contacts[ptrId] = currentContact;
                    ((System.Collections.Generic.IList<UIElement>)Scenario1OutputRoot.Children).Add(l);
                }
            }

            e.Handled = true;
        }
開發者ID:oldnewthing,項目名稱:old-Windows8-samples,代碼行數:32,代碼來源:Scenario1.xaml.cs

示例10: OnPointerPressed

 protected override void OnPointerPressed(PointerRoutedEventArgs e)
 {
     var position = e.GetCurrentPoint(SettingsPanel).Position.X < 0;
       if (SettingsPanel.Margin.Right == 0 && position)
     SettingsPanel.Margin = new Thickness(0, 0, -346, 0);
       base.OnPointerPressed(e);
 }
開發者ID:ktjones,項目名稱:BVCS2012,代碼行數:7,代碼來源:MainPage.xaml.cs

示例11: mapView_PointerMoved

        // HitTest the graphics and position the map tip
        private async void mapView_PointerMoved(object sender, PointerRoutedEventArgs e)
        {
            if (_isHitTesting)
                return;

            try
            {
                _isHitTesting = true;

                Point screenPoint = e.GetCurrentPoint(mapView).Position;
                var graphic = await _graphicsLayer.HitTestAsync(mapView, screenPoint);
                if (graphic != null)
                {
                    maptipTransform.X = screenPoint.X + 4;
                    maptipTransform.Y = screenPoint.Y - mapTip.ActualHeight;
                    mapTip.DataContext = graphic;
                    mapTip.Visibility = Visibility.Visible;
                }
                else
                    mapTip.Visibility = Visibility.Collapsed;
            }
            catch
            {
                mapTip.Visibility = Visibility.Collapsed;
            }
            finally
            {
                _isHitTesting = false;
            }
        }
開發者ID:KrisFoster44,項目名稱:arcgis-runtime-samples-dotnet,代碼行數:31,代碼來源:GraphicsMapTips.xaml.cs

示例12: OnCanvasPointerMoved

        private async void OnCanvasPointerMoved(object sender, PointerRoutedEventArgs e)
        {
            if (e.Pointer.PointerId != _mPenId) return;
            PointerPoint pt = e.GetCurrentPoint(InkCanvas);
            _currentContactPt = pt.Position;
            _x1 = Convert.ToInt32(_previousContactPt.X);
            _y1 = Convert.ToInt32(_previousContactPt.Y);
            _x2 = Convert.ToInt32(_currentContactPt.X);
            _y2 = Convert.ToInt32(_currentContactPt.Y);

            Color color = _mCurrentDrawingColor;
            const double size = MCurrentDrawingSize;

            if (Distance(_x1, _y1, _x2, _y2) > 2.0)
            {
                var line = new Line
                {
                    X1 = _x1,
                    Y1 = _y1,
                    X2 = _x2,
                    Y2 = _y2,
                    StrokeThickness = size,
                    Stroke = new SolidColorBrush(color)
                };

                _previousContactPt = _currentContactPt;

                InkCanvas.Children.Add(line);

                // Send a message to the server
                await _draw.Invoke("BroadcastPoint", _x2, _y2);
            }

            CurrentManager.ProcessPointerUpdate(pt);
        }
開發者ID:rwecho,項目名稱:Windows-Phone-Samples,代碼行數:35,代碼來源:MainPage.xaml.cs

示例13: MyMapView_PointerMoved

		private async void MyMapView_PointerMoved(object sender, PointerRoutedEventArgs e)
		{
			if (!_isMapReady)
				return;

			try
			{
				_isMapReady = false;

				Point screenPoint = e.GetCurrentPoint(MyMapView).Position;
				var rows = await _featureLayer.HitTestAsync(MyMapView, screenPoint);
				if (rows != null && rows.Length > 0)
				{
					var features = await _featureLayer.FeatureTable.QueryAsync(rows);
					_mapTip.DataContext = features.FirstOrDefault();
					_mapTip.Visibility = Visibility.Visible;
				}
				else
					_mapTip.Visibility = Visibility.Collapsed;
			}
			catch
			{
				_mapTip.Visibility = Visibility.Collapsed;
			}
			finally
			{
				_isMapReady = true;
			}
		}
開發者ID:MagicWang,項目名稱:arcgis-runtime-samples-dotnet,代碼行數:29,代碼來源:FeatureLayerMapTips.xaml.cs

示例14: MyCanvas_PointerMoved

        private void MyCanvas_PointerMoved(object sender, PointerRoutedEventArgs e)
        {
            PointerPoint point = e.GetCurrentPoint(this);
            // move paddle... x
            game.paddle.Move(point.Position.X);

        }
開發者ID:Taikakaulin,項目名稱:Olio,代碼行數:7,代碼來源:MainPage.xaml.cs

示例15: OnPointerWheelChanged

        private void OnPointerWheelChanged(object sender, PointerRoutedEventArgs e)
        {
            if (_isBusy)
            {
                return;
            }

            if (_panel.ItemsFitContent)
            {
                return;
            }

            var point = e.GetCurrentPoint(this);
            int sign = Math.Sign(point.Properties.MouseWheelDelta);
            if (sign > 0)
            {
                _headerContainer.TranslateDeltaX(1);
                _panelContainer.TranslateDeltaX(1);
                AnimatePrev();
            }
            else
            {
                _headerContainer.TranslateDeltaX(-1);
                _panelContainer.TranslateDeltaX(-1);
                AnimateNext();
            }
            e.Handled = true;
        }
開發者ID:ridomin,項目名稱:waslibs,代碼行數:28,代碼來源:Pivorama.Manipulation.cs


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