检测x& WP7屏幕中的y触摸事件 [英] Detect x & y touch event in WP7 screen

查看:56
本文介绍了检测x& WP7屏幕中的y触摸事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的需要帮助来返回WP7屏幕中的坐标x和y.此代码帮助我在屏幕上移动一个矩形,显示开始(x& y),增量(x,y)和结束(x,y):

I am really need help with return the coordinates x and y in the WP7 screen. this code help me to move an rectangle in the screen with showing the start(x&y), delta(x,y) and end(x,y) :

TransformGroup transformG;
        TranslateTransform translation;

        // Constructor
        public MainPage()
        {
            InitializeComponent();
            this.ManipulationDelta += new EventHandler<ManipulationDeltaEventArgs>(MainPage_ManipulationDelta);
            transformG = new TransformGroup();
            translation = new TranslateTransform();
            transformG.Children.Add(translation);
            rectangle.RenderTransform = transformG;
        }

        void MainPage_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            startX.Text =e.ManipulationOrigin.X.ToString();
            startY.Text = e.ManipulationOrigin.Y.ToString();
            DeltaX.Text = e.DeltaManipulation.Translation.X.ToString();
            DeltaY.Text = e.DeltaManipulation.Translation.Y.ToString();
            translation.X += e.DeltaManipulation.Translation.X;
            translation.Y += e.DeltaManipulation.Translation.Y;
            EndX.Text =Convert.ToString(translation.X);
            EndY.Text = Convert.ToString(translation.Y);
        }



我只想做类似的事情,但不做任何动作,只需在屏幕上轻按,就可以知道delta(差)的开始和结束.我使用silverlight



I just want to do something like that but without move anything, just tap in the screen and know the start and the end with delta (difference). I use silverlight

推荐答案

非常感谢,我找到了解决方法
它的工作无需定义矩形即可将其添加到翻译中

它可以自己工作
Thanks a lot, I find the solution
its work without define rectangle to add it in translation

it can work itself


这篇关于检测x&amp; WP7屏幕中的y触摸事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆