我现在想在自己触摸屏的开发板上实现这个效果,我猜大概是依据手指横向的滑动速度
1,主要不知道怎么来计算手指滑过触摸屏的速度
2,不知道手指滑过这个是mousedown=》mousemove=》mouseup的过程还是只是mousemove而已
3,想用计时器来计算这个速度,不知道效率怎么样大家出出主意,出出意见
1,主要不知道怎么来计算手指滑过触摸屏的速度
2,不知道手指滑过这个是mousedown=》mousemove=》mouseup的过程还是只是mousemove而已
3,想用计时器来计算这个速度,不知道效率怎么样大家出出主意,出出意见
IPhone的确爽呐。。 特别是游戏。。 是我玩过所以手机 感觉最爽得了。只是难冲电。 哈哈。
期待高手回答你得问题。
{
根据滑动范围和滑动时间来计算是否执行swipe
deltaX < 0? 'left':'right'
}
C# 只能应用iphone web.
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace WindowsApplication219
{
public partial class Form1 : Form
{
Point Old = new Point(-1, -1); public Form1()
{
InitializeComponent(); this.MouseMove += new MouseEventHandler(Form1_MouseMove);
} void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (Old.X != -1 && e.X - Old.X > 80)
MessageBox.Show("!");
Old = e.Location;
}
else
Old = new Point(-1, -1);
}
}
}
{
Point oldpoint;
Point newpoint; bool startmove = false;
int count = 0; public Form1()
{
InitializeComponent();
} private void timer1_Tick(object sender, EventArgs e)
{
count++;
} private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (startmove)
{
float a = (e.X - oldpoint.X) * 10 / count;
if(a>500)
{
MessageBox.Show("到达500的位移速度!");
}
} } private void Form1_MouseDown(object sender, MouseEventArgs e)
{
startmove = true;
count = 1;
oldpoint = e.Location;
this.timer1.Start();
} private void Form1_MouseUp(object sender, MouseEventArgs e)
{
startmove = false;
newpoint = e.Location;
this.timer1.Stop();
float a = (newpoint.X - oldpoint.X)*10 / count;
this.label1.Text = a.ToString();
}
}写了一段测试的代码,大家看看行不?