vb编程中想在窗体中间点击鼠标左键拖动整个窗体在屏幕上移动 编码怎么写呀,求高手指点。
1个回答
展开全部
Dim t As Boolean
Dim tx, ty As Integer
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
t = True
tx = X
ty = Y
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If t = True Then
Form1.Top = Y + Form1.Top - ty
Form1.Left = X + Form1.Left - tx
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
t = False
End Sub
Dim tx, ty As Integer
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
t = True
tx = X
ty = Y
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If t = True Then
Form1.Top = Y + Form1.Top - ty
Form1.Left = X + Form1.Left - tx
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
t = False
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询