1个回答
2013-09-23
展开全部
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.KeyPreview = True '设置处理窗体的鼠标事件
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
Button1.Location = New Point(e.X, e.Y) '将控件的位置设成鼠标的位置,控件即随鼠标移动
End Sub
Me.KeyPreview = True '设置处理窗体的鼠标事件
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
Button1.Location = New Point(e.X, e.Y) '将控件的位置设成鼠标的位置,控件即随鼠标移动
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询