2个回答
展开全部
用多线程即可。
新建一个项目,在Form1上画一个Button1,窗体代码如下:
Public Class Form1
Sub MoveForm()
For i As Integer = 1270 To 1000 Step -1
Me.Location = New Point(i, 150)
Threading.Thread.Sleep(10)
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Control.CheckForIllegalCrossThreadCalls = False
Dim th As New Threading.Thread(AddressOf MoveForm)
th.Start()
End Sub
End Class
生成看效果
新建一个项目,在Form1上画一个Button1,窗体代码如下:
Public Class Form1
Sub MoveForm()
For i As Integer = 1270 To 1000 Step -1
Me.Location = New Point(i, 150)
Threading.Thread.Sleep(10)
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Control.CheckForIllegalCrossThreadCalls = False
Dim th As New Threading.Thread(AddressOf MoveForm)
th.Start()
End Sub
End Class
生成看效果
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询