如何创建延迟时间? [英] how to create the delay time?

查看:89
本文介绍了如何创建延迟时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在循环例程中创建具有几毫秒延迟时间的代码.
我不知道该怎么做.请帮帮我.

我的代码:

I''m trying to create a code with some millisecond delay time in loop routine.
I don''t know how to do it. Please help me.

my code :

for (i=1;i<10;i++)
{
   int a=mycode(); // mycode is my function name, it will return the delay time
   System.Threading.Thread.Sleep(Delay_Time_cell);
   Application.DoEvents();
}

int mycode()
{
.....
.....
.....
return;
}



但是延迟时间不起作用?



But delay time is not working?

推荐答案

尝试此链接

点击此处 [
try this Link

Clickhere[^]


如果由于某种原因而无法使用Thread.Sleep,则始终可以使用简单的 dummy for循环.

If you are unable to use Thread.Sleep for some reason then you can always use a simple dummy for loop.

for(int idelay=0; iDelay < 10000; iDelay++);


您可以使用计时器
如果线程不起作用...
you can use timer
if the thread is not working...


这篇关于如何创建延迟时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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