本文整理汇总了C#中Microsoft.GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.GetPosition方法的具体用法?C# Microsoft.GetPosition怎么用?C# Microsoft.GetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft
的用法示例。
在下文中一共展示了Microsoft.GetPosition方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GestureListener_DragCompleted
private void GestureListener_DragCompleted(object sender, Microsoft.Phone.Controls.DragCompletedGestureEventArgs e)
{
double startXCoordinate = e.GetPosition(this.MainCanvas).X - e.HorizontalChange;
double startYCoordinate = e.GetPosition(this.MainCanvas).Y - e.VerticalChange;
Point point = new Point(startXCoordinate, startYCoordinate);
Hex startHex = Game.BoardFactory.GetClosestHex(point);
Hex targetHex = Game.BoardFactory.GetClosestHex(e.GetPosition(this.MainCanvas));
if (Game.BoardFactory.AllowDragEvent(startHex, targetHex))
{
Game.BoardFactory.HandleDragEvent(targetHex);
}
}
示例2: GestureListener_Tap
private void GestureListener_Tap(object sender, Microsoft.Phone.Controls.GestureEventArgs e)
{
if (Game.CurrentViewLevel > 1)
{
Hex closestHex = Game.BoardFactory.GetClosestHex(e.GetPosition(this.MainCanvas));
Game.BoardFactory.HandleTapEvent(closestHex);
}
}
示例3: GestureListener_Hold
private void GestureListener_Hold(object sender, Microsoft.Phone.Controls.GestureEventArgs e)
{
var pushpinLocation = googlemap.ViewportPointToLocation(e.GetPosition(googlemap));
Pushpin pushpin = new Pushpin
{
Location = pushpinLocation,
Template = Application.Current.Resources["PushpinControlTemplate"] as ControlTemplate,
Content = "1"
};
if (googlemap.Children.Any(p => p is Pushpin))
googlemap.Children.Remove(googlemap.Children.Single(p => p is Pushpin));
googlemap.Children.Add(pushpin);
EnableProceedButton();
}
示例4: ScrollViewer_Tapped
protected void ScrollViewer_Tapped(object sender, Microsoft.Phone.Controls.GestureEventArgs e)
{
_offsetAtTap = null;
_ignoreDoubleTap = false;
if (HideButtonPanel())
{
return;
}
if (App.Settings.IsTapIgnored)
{
return;
}
ScrollViewer scrollViewer = (sender as ScrollViewer);
scrollViewer.UpdateLayout();
_offsetAtTap = scrollViewer.VerticalOffset;
if (scrollViewer != null)
{
_handleTap = true;
Naboo.AppUtil.AsyncCallHelper.DelayCall(
() =>
{
_ignoreDoubleTap = true;
if (!_handleTap)
{
return;
}
try
{
Point tapPos = e.GetPosition(scrollViewer);
if (tapPos.Y < (scrollViewer.ActualHeight / 6))
{
scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset - (scrollViewer.ActualHeight - 60));
}
else if (tapPos.Y > (scrollViewer.ActualHeight * 5 / 6))
{
scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset + (scrollViewer.ActualHeight - 60));
}
}
catch (Exception ex)
{
}
},
300
);
}
}
示例5: ScrollViewer_DoubleTapped
protected void ScrollViewer_DoubleTapped(object sender, Microsoft.Phone.Controls.GestureEventArgs e)
{
double? offsetAtTap = _offsetAtTap;
_handleTap = false;
_offsetAtTap = null;
if (App.Settings.IsTapIgnored)
{
return;
}
if (_ignoreDoubleTap)
{
return;
}
ScrollViewer scrollViewer = (sender as ScrollViewer);
if (scrollViewer != null)
{
Point tapPos = e.GetPosition(scrollViewer);
if (tapPos.Y < (scrollViewer.ActualHeight / 6))
{
scrollViewer.ScrollToVerticalOffset(0);
}
else if (tapPos.Y > (scrollViewer.ActualHeight * 5 / 6))
{
bool foundNextPost = false;
//scrollViewer.UpdateLayout();
//_topicBodyPanel.UpdateLayout();
//if (offsetAtTap.HasValue)
//{
// offsetAtTap = offsetAtTap.Value + scrollViewer.ActualHeight;
//}
//else
//{
// offsetAtTap = scrollViewer.VerticalOffset + scrollViewer.ActualHeight;
//}
//foreach (UIElement control in _firstPostControls)
//{
// if (_topicBodyPanel.Children.Contains(control))
// {
// GeneralTransform transformToVisual = control.TransformToVisual(_topicBodyPanel);
// Point controlPos = transformToVisual.Transform(new Point(0, 0));
// if (controlPos.Y > offsetAtTap.Value)
// {
// scrollViewer.ScrollToVerticalOffset(controlPos.Y);
// foundNextPost = true;
// break;
// }
// }
//}
if (!foundNextPost)
{
scrollViewer.ScrollToVerticalOffset(double.MaxValue);
}
}
}
}
示例6: myGridGestureListener_DoubleTap
private void myGridGestureListener_DoubleTap(object sender, Microsoft.Phone.Controls.GestureEventArgs e)
{
var point = e.GetPosition(image);
_relativeMidpoint = new Point(point.X / image.ActualWidth, point.Y / image.ActualHeight);
var xform = image.TransformToVisual(viewport);
_screenMidpoint = xform.Transform(point);
if (_coercedScale >= (_minScale * 2.5) || _coercedScale < 0)
_coercedScale = _minScale;
else
_coercedScale *= 1.75;
ResizeImage(false);
}