本文整理汇总了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;
}
示例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);
}
}
示例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);
});
}
示例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);
}