3个回答
展开全部
Private mousetool As Boolean = False
Private oPointClicked As Point
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
If Me.mousetool = True Then '如果移动
Dim oMoveToPoint As Point
' 以当前鼠标位置为基础(, 找出目标位置)
oMoveToPoint = Me.PointToScreen(New Point(e.X, e.Y))
oMoveToPoint.Offset(Me.oPointClicked.X * -1, _
(Me.oPointClicked.Y + _
SystemInformation.CaptionHeight + _
SystemInformation.BorderSize.Height) * -1)
' 移动窗体
Me.Location = oMoveToPoint
End If
End Sub
用这个类(VB)
Private oPointClicked As Point
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
If Me.mousetool = True Then '如果移动
Dim oMoveToPoint As Point
' 以当前鼠标位置为基础(, 找出目标位置)
oMoveToPoint = Me.PointToScreen(New Point(e.X, e.Y))
oMoveToPoint.Offset(Me.oPointClicked.X * -1, _
(Me.oPointClicked.Y + _
SystemInformation.CaptionHeight + _
SystemInformation.BorderSize.Height) * -1)
' 移动窗体
Me.Location = oMoveToPoint
End If
End Sub
用这个类(VB)
更多追问追答
追问
貌似不能用。。。注意是WPF
追答
额……我只会VB……
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Window_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Input.MouseEventArgs)
If e.LeftButton = MouseButtonState.Pressed Then
DragMove()
End If
End Sub
If e.LeftButton = MouseButtonState.Pressed Then
DragMove()
End If
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
解决了就好
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询