0

有没有办法当我单击 ToolStripButton 时,它会显示 WaitCursor 并更新 StatusStrip 约 10 秒,然后恢复正常。我只是不知道如何输入编码。

如果有人可以指导我完成整个过程。(甚至给我代码)

谢谢你

J马洪

4

2 回答 2

0

Using a timer:

1:Add a timer from your component toolbox to your form.

2:Set the inteval to 10,000 (this is in milliseconds, 1000 = 1 second)

3:In the timers' "Tick" event, write this code:

Timer1.stop 'This assumes your timer it named Timer1
Me.Cursor = Cursors.Default

4: When you want to make it show the cursor, either have a method to do both these lines and call the method or just write these 2 lines all over the place:

Me.Cursor = Cursors.WaitCursor
Timer1.Start
于 2013-10-16T20:39:26.093 回答
0

我建议使用 async/await 来保持“正常”程序流程。

Me.Cursor = Cursors.WaitCursor
Await Task.Delay(10000)
Me.Cursor = Cursors.Default
于 2013-10-16T21:05:31.343 回答