在用VB写WPF时用什么事件和代码实现窗口(Main Window)拖动
1个回答
展开全部
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button And vbLeftButton Then
xCursor = X: yCursor = Y
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button And vbLeftButton Then
Me.Move Me.Left - xCursor + X, Me.Top - yCursor + Y
End If
End Sub ' ,如果是控件的话 修改Form_MouseMove ,Form_MouseDown就好饿啦!!!form改成控件名称!!!
If Button And vbLeftButton Then
xCursor = X: yCursor = Y
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button And vbLeftButton Then
Me.Move Me.Left - xCursor + X, Me.Top - yCursor + Y
End If
End Sub ' ,如果是控件的话 修改Form_MouseMove ,Form_MouseDown就好饿啦!!!form改成控件名称!!!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询