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