Can a timer be started as a thread and execute with KeyDown?

Hi,

Can a timer tick event be started as a seperate thread and be executed concurrently with the KeyDown event?

When I press the Up arrow key, a picturebox1 has to go up and down the form vertically (jumping). At the same time, I would like the timer tick event to continue to move another picturebox2 from right to left on the form by 1 pixel for each tick event.

Initially, these 2 events cant be dealt with concurrently by vb, so I used the Application.DoEvent() method recommended by some replies I have received in the forums.

It works partially. Pictuerbox2 can move while the up arrow key is being pressed but it moves jerkily. Besides, when the arrow key is being released, picturebox1 continues to jump when it is supposed to stop.

So can I start a new thread which can execute when these 2 events occur?
If so, could you provide a simple example?
[906 byte] By [ZhiYi] at [2007-11-19 21:57:24]
# 1 Re: Can a timer be started as a thread and execute with KeyDown?
The timer is executed on a different thread. However, all the graphics is done in one thread. So if you see flickering then maybe the timer is too fast? Maybe you should not handle every press on the key?
jhammer at 2007-11-10 3:13:39 >