VB-窗体移动问题
VBproblem:有两个无标题栏窗体:当使用api函数的使其中一个窗体移动时,另外一个窗体怎么随之移动?...
VB problem:
有两个无标题栏窗体:
当使用api函数的使其中一个窗体移动时,另外一个窗体怎么随之移动? 展开
有两个无标题栏窗体:
当使用api函数的使其中一个窗体移动时,另外一个窗体怎么随之移动? 展开
1个回答
展开全部
不用API就行了
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
If Button = 1 Then
Mouse_X = x
Mouse_Y = Y
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
Dim CurrentMouse_X As Single, CurrentMouse_Y As Single
If Button = 1 Then
CurrentMouse_X = x - Mouse_X
CurrentMouse_Y = Y - Mouse_Y
Form1.Left = Form1.Left + CurrentMouse_X
Form1.Top = Form1.Top + CurrentMouse_Y
End If
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
If Button = 1 Then
Mouse_X = x
Mouse_Y = Y
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
Dim CurrentMouse_X As Single, CurrentMouse_Y As Single
If Button = 1 Then
CurrentMouse_X = x - Mouse_X
CurrentMouse_Y = Y - Mouse_Y
Form1.Left = Form1.Left + CurrentMouse_X
Form1.Top = Form1.Top + CurrentMouse_Y
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询