vb.net none窗体移动
用Ifx=e.XAndy=e.YThenExitSubIfe.Button=Windows.Forms.MouseButtons.LeftThenMe.Left=Me.L...
用
If x = e.X And y = e.Y Then Exit Sub
If e.Button = Windows.Forms.MouseButtons.Left Then
Me.Left = Me.Left + e.X - x
Me.Top = Me.Top + e.Y - y
End If
这个运行后移动是可以,但移动快点就移动不到了,C#有API——
if (e.LeftButton == MouseButtonState.Pressed)
{
DragMove();
}
不会有这个问题,但VB.net没有,vb.net能解决移动快没用的问题吗
你没有达到我的要求,362748088,推荐答案是错误的。 展开
If x = e.X And y = e.Y Then Exit Sub
If e.Button = Windows.Forms.MouseButtons.Left Then
Me.Left = Me.Left + e.X - x
Me.Top = Me.Top + e.Y - y
End If
这个运行后移动是可以,但移动快点就移动不到了,C#有API——
if (e.LeftButton == MouseButtonState.Pressed)
{
DragMove();
}
不会有这个问题,但VB.net没有,vb.net能解决移动快没用的问题吗
你没有达到我的要求,362748088,推荐答案是错误的。 展开
2个回答
展开全部
Public Class Form1
Private m_bDown As Boolean, m_stPTStart As Point
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
m_bDown = True
m_stPTStart.X = e.X
m_stPTStart.Y = e.Y
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If m_bDown = False Then Exit Sub
Dim nDeltaX%, nDeltaY%
nDeltaX = e.X - m_stPTStart.X
nDeltaY = e.Y - m_stPTStart.Y
Me.Left = Me.Left + nDeltaX
Me.Top = Me.Top + nDeltaY
End Sub
Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
m_bDown = False
End Sub
End Class
Private m_bDown As Boolean, m_stPTStart As Point
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
m_bDown = True
m_stPTStart.X = e.X
m_stPTStart.Y = e.Y
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If m_bDown = False Then Exit Sub
Dim nDeltaX%, nDeltaY%
nDeltaX = e.X - m_stPTStart.X
nDeltaY = e.Y - m_stPTStart.Y
Me.Left = Me.Left + nDeltaX
Me.Top = Me.Top + nDeltaY
End Sub
Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
m_bDown = False
End Sub
End Class
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2010-12-11
展开全部
实现无边框的窗体移动吧?我以前也遇到这个问题,做过很久,最后放弃了,这个是没办法的
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询