vb.net 不会无响应的延时函数delay时间:2021-12-31 23:42:03用系统Threading.Thread.Sleep函数延时过程中会造成程序无响应,特别是最小化窗口后,经常无法正常激活窗口,下面这个就好多了。参数单位为毫秒 Public Shared Sub delay(ByVal Interval As Integer) Dim __time As DateTime = DateTime.Now Dim __Span As Int64 = Interval *10000 '因为时间是以100纳秒为单位。 While (DateTime.Now.Ticks -__time.Ticks < __Span) Application.DoEvents() End While End Sub