找出任何两个事件之间的时间差. [英] Find the difference in time between any two events.

查看:100
本文介绍了找出任何两个事件之间的时间差.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想捕捉两个事件之间的时间差,我的要求是这样的:-

我正在创建一个计算事件之间差异的应用程序.用户单击鼠标,然后单击键盘上的按键事件,然后再次单击鼠标事件.现在,我的要求是找到前两个事件之间的差异,即鼠标单击和按键,然后是最后两个事件之间的区别,即按键和再次单击.

I want to capture the difference in time between two events.My requirement is like this :-

I am creating an application which calculates the difference between events.The User do a click on mouse and after that a key press event from keyboard and again the mouse click event.Now my requirement is to find the difference between the first two event i.e. mouse click and Key press and then differnce between the last two event i.e. key press and again muse click.

Please help me and share the code if possible.

推荐答案

将两个事件的时间分成两个变量.
然后使用TimeSpan 计算差异.

此处 [
Trap the time for the two events in two variables.
Then use TimeSpan to calculate the difference.

Here[^] is a simple example.


这篇关于找出任何两个事件之间的时间差.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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