本文整理汇总了C#中Microsoft.Phone.Controls.GestureEventArgs.GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# GestureEventArgs.GetPosition方法的具体用法?C# GestureEventArgs.GetPosition怎么用?C# GestureEventArgs.GetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Phone.Controls.GestureEventArgs
的用法示例。
在下文中一共展示了GestureEventArgs.GetPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: imgResult_Tap
private void imgResult_Tap(object sender, GestureEventArgs e)
{
//Si premier clic, on enrgistre le X et le Y
if (clic1)
{
tmp.X = Convert.ToInt32(e.GetPosition(imgResult).X);
tmp.Y = Convert.ToInt32(e.GetPosition(imgResult).Y);
//On affiche le premier point
e1.Margin = new Thickness(tmp.X, tmp.Y, 0, 0);
e1.Visibility = Visibility.Visible;
clic1 = false;
clic2 = true;
return;
}
//Si second clic, on enregistre longeur et largeur
if (clic2)
{
//Longueur
int x = Convert.ToInt32(e.GetPosition(imgResult).X);
if (tmp.X > x)
{
MessageBox.Show("This point should be the corner on the down right", "Error", MessageBoxButton.OK);
}
else
{
tmp.Longueur = x - tmp.X;
int y = Convert.ToInt32(e.GetPosition(imgResult).Y);
if (tmp.Y > y)
{
MessageBox.Show("This point should be the corner on the down right", "Error", MessageBoxButton.OK);
}
else
{
tmp.Hauteur = y - tmp.Y;
clic2 = false;
//On enlève l'ellipse
e1.Visibility = Visibility.Collapsed;
//On affiche le rectable
r1.Margin = new Thickness(e1.Margin.Left + 10, e1.Margin.Top +6,0,0);
r1.Width = tmp.Longueur;
r1.Height = tmp.Hauteur;
r1.Visibility = Visibility.Visible;
//On choisit l'objet
objet = true;
ContentPanelItem.Visibility = Visibility.Visible;
}
}
}
}
示例2: Border_Tap
private void Border_Tap(object sender, GestureEventArgs e)
{
//determine the click location
var pos = e.GetPosition(_border);
// forward to the browser
_browser.InvokeScript("eval",
string.Format("document.elementFromPoint({0},{1}).click()", pos.X, pos.Y));
}
示例3: GestureListener_Hold
private void GestureListener_Hold(object sender, GestureEventArgs e)
{
if (ok == false)
{
ok = true;
var pushPin = new Pushpin();
var position = e.GetPosition(map1);
var location = map1.ViewportPointToLocation(position);
thisApp.Lat = (decimal)location.Latitude;
thisApp.Long = (decimal)location.Longitude;
PushpinLayer.AddChild(pushPin, location);
}
}
示例4: OnTap
private void OnTap(object sender, GestureEventArgs e)
{
Point p = e.GetPosition(flipControl);
if (flipControl.IsFlipped)
{
flipControl.FlipDirection = (p.X > flipControl.ActualWidth / 2.0) ? FlipDirection.Backwards : FlipDirection.Forwards;
}
else
{
flipControl.FlipDirection = (p.X < flipControl.ActualWidth / 2.0) ? FlipDirection.Backwards : FlipDirection.Forwards;
}
flipControl.IsFlipped = !flipControl.IsFlipped;
}
示例5: map1_Tap
void map1_Tap(object sender, GestureEventArgs e)
{
if (oneMarker != null)
{
Point markPoint = map1.ConvertGeoCoordinateToViewportPoint(oneMarker.GeoCoordinate);
if ((markPoint.X < 0 || markPoint.Y < 0)
|| (map1.ActualWidth < markPoint.X) || (map1.ActualHeight < markPoint.Y))
{
// tap event when we do not have the marker visible, so lets move it here
oneMarker.GeoCoordinate = map1.ConvertViewportPointToGeoCoordinate(e.GetPosition(map1));
DoCreateTheAreaCircle();
if (twoMarker != null && PolyCircle != null && PolyCircle.Path != null)
{
twoMarker.GeoCoordinate = PolyCircle.Path[0];
}
}
}
}
示例6: Map_Hold
void Map_Hold(object sender, GestureEventArgs e)
{
ClearQuery();
Point2D point = myMap.ScreenToMap(e.GetPosition(myMap));
double radius = 100000;//Map.Resolution * 10;
Utility.Point2D p = new Utility.Point2D(point.X, point.Y);
Utility.Geometry geometry = new Utility.Geometry();
geometry.Type = Utility.GeometryType.POINT;
geometry.Parts = new int[] { 1 };
geometry.Points = new Utility.Point2D[1] { p };
Utility.QueryParameterSet query = new Utility.QueryParameterSet();
query.ReturnContent = true;
query.ExpectCount = 1;
query.QueryOption = Utility.QueryOption.ATTRIBUTEANDGEOMETRY;
query.QueryParams = new Utility.QueryParameter[] { new Utility.QueryParameter("[email protected]") };
_queryMap.FindNearest(mapName, geometry, radius, query,
new EventHandler<Utility.QueryEventArgs>(Query_Completed), new EventHandler<Utility.FailedEventArgs>(Query_Failed));
}
示例7: gesture_Hold
private void gesture_Hold(object sender, GestureEventArgs e)
{
var point = e.GetPosition(ContentPanel);
message.Text = string.Format("hold at ({0},{1})", point.X, point.Y);
}
示例8: gesture_Tap
private void gesture_Tap(object sender, GestureEventArgs e)
{
var point = e.GetPosition(ContentPanel);
message.Text = string.Format("tap at ({0},{1})", point.X, point.Y);
flickMessage.Text = null;
}
示例9: OnPreviewTap
/// <summary>
/// <see cref="UIElement.Tap"/> event handler.
/// </summary>
/// <param name="sender">Event sender.</param>
/// <param name="e">The <see cref="GestureEventArgs"/> instance containing the event data.</param>
private void OnPreviewTap(object sender, GestureEventArgs e)
{
Point pointOnPreview = e.GetPosition(this.LivePreview);
// Don't notify about touches made close to the edges.
if (pointOnPreview.X < this.TapBoundary || pointOnPreview.X > this.LivePreview.Width - this.TapBoundary
|| pointOnPreview.Y < this.TapBoundary || pointOnPreview.Y > this.PreviewHeight - this.TapBoundary)
{
return;
}
Point positionPercentage = new Point(pointOnPreview.X / this.LivePreview.ActualWidth, pointOnPreview.Y / this.LivePreview.ActualHeight);
// We flip preview's X-axis for the front-facing camera.
if (this.cameraType == CameraType.FrontFacing)
{
positionPercentage.X = 1.0 - positionPercentage.X;
}
EventHandler<PreviewTapLocationEventArgs> handler = this.PreviewTap;
if (handler != null)
{
handler.Invoke(this, new PreviewTapLocationEventArgs(positionPercentage));
}
}
示例10: LayoutRoot_Tap
private void LayoutRoot_Tap(object sender, GestureEventArgs e)
{
Point p = e.GetPosition(null);
MessageBox.Show(string.Format("X = {0}, Y = {1}", p.X, p.Y));
}
示例11: BingMap_Tap
/// <summary>
/// Occurs when the user taps on the map.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BingMap_Tap(object sender, GestureEventArgs e)
{
if (_pin == null)
{
// Drop a pushpin representing the pin.
_pin = new Pushpin();
_pin.Template = Resources["PinPushpinTemplate"] as ControlTemplate;
BingMap.Children.Add(_pin);
}
// Determine the coordinates of the point that was tapped.
var point = e.GetPosition(BingMap);
var newPinLocation = BingMap.ViewportPointToLocation(point);
// Update pin's location and the distance to me.
_pin.Location = newPinLocation;
ViewModel.Pin = newPinLocation;
ViewModel.UpdateDistance();
}
示例12: listener_Hold
void listener_Hold(object sender, GestureEventArgs e)
{
((MenuItem)menu.Items[0]).Header = "Identifying Location...";
menu.IsOpen = true;
System.Device.Location.GeoCoordinate location = this.BingMap.ViewportPointToLocation(e.GetPosition(this.BingMap));
MobileSrc.Services.GeocodeServices.GeocodeServiceClient rclient = new MobileSrc.Services.GeocodeServices.GeocodeServiceClient("BasicHttpBinding_IGeocodeService");
MobileSrc.Services.GeocodeServices.ReverseGeocodeRequest req = new MobileSrc.Services.GeocodeServices.ReverseGeocodeRequest();
req.Credentials = new MobileSrc.Services.GeocodeServices.Credentials();
req.Credentials.ApplicationId = BingMapsApiKey;
req.Location = new MobileSrc.Services.GeocodeServices.Location();
req.Location.Latitude = location.Latitude;
req.Location.Longitude = location.Longitude;
req.ExecutionOptions = new MobileSrc.Services.GeocodeServices.ExecutionOptions();
rclient.ReverseGeocodeCompleted += new EventHandler<MobileSrc.Services.GeocodeServices.ReverseGeocodeCompletedEventArgs>(client_ReverseGeocodeCompleted);
rclient.ReverseGeocodeAsync(req);
}
示例13: LayoutRoot_Tap
private void LayoutRoot_Tap(object sender, GestureEventArgs e)
{
this.LayoutRoot.Tap -= LayoutRoot_Tap;
this.PlayAudioFile("ThrowAudio.wav");
Image tomatoImage = new Image();
tomatoImage.Source = new BitmapImage(new Uri("tomato.png", UriKind.RelativeOrAbsolute));
tomatoImage.Height = 74;
tomatoImage.Width = 63;
TomatoRedirection(tomatoImage);
_tomatoImages.Add(tomatoImage);
LayoutRoot.Children.Add(tomatoImage);
System.Windows.Point tappedHere = e.GetPosition(this.LayoutRoot);
_tappedPoints.Add(tappedHere);
_tapCount++;
// Create a duration of 0.5 seconds.
Duration duration = new Duration(TimeSpan.FromMilliseconds(400));
// Create two DoubleAnimations and set their properties.
DoubleAnimation myDoubleAnimation1 = new DoubleAnimation();
DoubleAnimation myDoubleAnimation2 = new DoubleAnimation();
myDoubleAnimation1.Duration = duration;
myDoubleAnimation2.Duration = duration;
Storyboard sb = new Storyboard();
sb.Duration = duration;
sb.Children.Add(myDoubleAnimation1);
sb.Children.Add(myDoubleAnimation2);
Storyboard.SetTarget(myDoubleAnimation1, tomatoImage);
Storyboard.SetTarget(myDoubleAnimation2, tomatoImage);
// Set the attached properties of Canvas.Left and Canvas.Top
// to be the target properties of the two respective DoubleAnimations.
Storyboard.SetTargetProperty(myDoubleAnimation1, new PropertyPath("(Canvas.Left)"));
Storyboard.SetTargetProperty(myDoubleAnimation2, new PropertyPath("(Canvas.Top)"));
myDoubleAnimation1.To = tappedHere.X;//widhth 63
myDoubleAnimation2.To = tappedHere.Y; //Height 74
ScaleTransform scale = new ScaleTransform();
tomatoImage.RenderTransformOrigin = new System.Windows.Point(0.5, 0.5);
tomatoImage.RenderTransform = scale;
DoubleAnimation growAnimationX = new DoubleAnimation();
growAnimationX.Duration = TimeSpan.FromMilliseconds(300);
growAnimationX.From = 5;
growAnimationX.To = 1;
DoubleAnimation growAnimationY = new DoubleAnimation();
growAnimationY.Duration = TimeSpan.FromMilliseconds(300);
growAnimationY.From = 5;
growAnimationY.To = 1;
Storyboard.SetTargetProperty(growAnimationX, new PropertyPath("(Image.RenderTransform).(ScaleTransform.ScaleX)"));
Storyboard.SetTarget(growAnimationX, tomatoImage);
Storyboard.SetTargetProperty(growAnimationY, new PropertyPath("(Image.RenderTransform).(ScaleTransform.ScaleY)"));
Storyboard.SetTarget(growAnimationY, tomatoImage);
sb.Children.Add(growAnimationX);
sb.Children.Add(growAnimationY);
// Begin the animation.
sb.Begin();
sb.Completed += new EventHandler(sb_Completed);
}
示例14: gestureListener_DoubleTap
private void gestureListener_DoubleTap(object sender, GestureEventArgs e)
{
if (imageMan == null)
return;
Point p = e.GetPosition(image);
if (zoomed)
{
zoomed = false;
ApplyZoomTransform(sender as Image, 1, p);
}
else
{
zoomed = true;
ApplyZoomTransform(sender as Image, zoomFactor, p);
}
}
示例15: OnMyCameraMediaElementTapped
/// <summary>
/// Changes the current camera effect.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void OnMyCameraMediaElementTapped(object sender, GestureEventArgs e) {
var uiTapPoint = e.GetPosition(_mediaElement);
if (_focusSemaphore.WaitOne(0)) {
// Get tap coordinates as a foundation point
var tapPoint = new Windows.Foundation.Point(uiTapPoint.X, uiTapPoint.Y);
// adjust to center focus on the tap point
var displayOrigin = new Windows.Foundation.Point(
tapPoint.X - _focusRegionSize.Width / 2,
tapPoint.Y - _focusRegionSize.Height / 2);
// adjust for resolution difference between preview image and the canvas
var viewFinderOrigin = new Windows.Foundation.Point(displayOrigin.X , displayOrigin.Y);
var focusrect = new Windows.Foundation.Rect(viewFinderOrigin, _focusRegionSize);
// clip to preview resolution
var viewPortRect = new Windows.Foundation.Rect(0, 0,_camera.PreviewResolution.Width,_camera.PreviewResolution.Height);
focusrect.Intersect(viewPortRect);
_camera.FocusRegion = focusrect;
// show a focus indicator
FocusIndicator.Margin = new Thickness(uiTapPoint.X - (_focusRegionSize.Width/2), uiTapPoint.Y - (_focusRegionSize.Height/2), 0, 0);
FocusIndicator.SetValue(Shape.StrokeProperty, _notFocusedBrush);
FocusIndicator.SetValue(Canvas.VisibilityProperty, Visibility.Visible);
CameraFocusStatus status = await _camera.FocusAsync();
if (status == CameraFocusStatus.Locked) {
FocusIndicator.SetValue(Shape.StrokeProperty, _focusedBrush);
_manuallyFocused = true;
_camera.SetProperty(KnownCameraPhotoProperties.LockedAutoFocusParameters,
AutoFocusParameters.Exposure & AutoFocusParameters.Focus & AutoFocusParameters.WhiteBalance);
} else {
_manuallyFocused = false;
_camera.SetProperty(KnownCameraPhotoProperties.LockedAutoFocusParameters, AutoFocusParameters.None);
}
_focusSemaphore.Release();
}
}