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


C# UIElement.CapturePointer方法代码示例

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


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

示例1: 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

示例2: PointerPressed

        private void PointerPressed(PointerPoint pointerPoint, UIElement target, Pointer pointer)
        {
            // To convert from DIPs (device independent pixels) to screen resolution pixels.
            var dipFactor = DisplayProperties.LogicalDpi / 96.0f;
            var pos = new Vector2((float)pointerPoint.Position.X, (float)pointerPoint.Position.Y) * dipFactor;

            var isTouch = pointerPoint.PointerDevice.PointerDeviceType == PointerDeviceType.Touch;

            _touchQueue.Enqueue((int)pointerPoint.PointerId, TouchLocationState.Pressed, pos, !isTouch);
            
            if (!isTouch)
            {
                // Mouse or stylus event.
                UpdateMouse(pointerPoint);

                // Capture future pointer events until a release.		
                if (target != null)
                    target.CapturePointer(pointer);
            }
        }
开发者ID:BrainSlugs83,项目名称:MonoGame,代码行数:20,代码来源:InputEvents.cs

示例3: BeginFluidDragAsync

        /// <summary>
        /// Handler for the event when the user starts dragging the dragElement.
        /// </summary>
        /// <param name="child">UIElement being dragged</param>
        /// <param name="position">Position in the child where the user clicked</param>
        /// <param name="pointer">Pointer</param>
        internal async Task BeginFluidDragAsync(UIElement child, Point position, Pointer pointer)
        {
            if ((child == null) || (!IsComposing))
                return;

            // Call the event handler core on the Dispatcher. (Improves efficiency!)
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                child.Opacity = DragOpacity;
                child.SetValue(Canvas.ZIndexProperty, Z_INDEX_DRAG);
                // Capture further mouse events
                child.CapturePointer(pointer);
                _dragElement = child;
                _lastDragElement = null;

                // Since we are scaling the dragElement by DragScale, the clickPoint also shifts
                _dragStartPoint = new Point(position.X * DragScale, position.Y * DragScale);
            });
        }
开发者ID:ChrisCross67,项目名称:wpfspark,代码行数:25,代码来源:FluidWrapPanel.cs

示例4: BeginFluidDrag

        /// <summary>
        /// Handler for the event when the user starts dragging the dragElement.
        /// </summary>
        /// <param name="child">UIElement being dragged</param>
        /// <param name="position">Position in the child where the user clicked</param>
        /// <param name="pointer">Pointer</param>
        internal void BeginFluidDrag(UIElement child, Point position, Pointer pointer)
        {
            if ((child == null) || (!IsComposing))
                return;

            child.SetValue(Canvas.ZIndexProperty, ZIndexDrag);
            // Capture further pointer events
            child.CapturePointer(pointer);
            _dragElement = child;

            var visual = _fluidVisuals[_dragElement];
            visual.Opacity = (float)DragOpacity;
            visual.CenterPoint = new Vector3((float)position.X, (float)position.Y, 0);
            visual.Scale = new Vector3((float)DragScale, (float)DragScale, 1);
            visual.ImplicitAnimations = _implicitDragAnimationCollection;

            // Set the starting position of the drag
            _dragStartPoint = new Point(position.X, position.Y);
        }
开发者ID:RareNCool,项目名称:CompositionProToolkit,代码行数:25,代码来源:FluidWrapPanel.cs


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