vb移动没有标题栏的窗口
用的vs2013里的vb做窗口程序取消了标题栏,想整个窗口都可以移动在网上查了这个代码,没有用啊Dimmouse_xAsSingleDimmouse_yAsSingleP...
用的vs2013里的vb做窗口程序
取消了标题栏,想整个窗口都可以移动
在网上查了这个代码,没有用啊
Dim mouse_x As Single
Dim mouse_y As Single
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
mouse_x = 0
mouse_y = 0
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)
If Button = 1 Then
Me.Left = Me.Left + (X - mouse_x)
Me.Top = Me.Top + (Y - mouse_y)
End If
End Sub 展开
取消了标题栏,想整个窗口都可以移动
在网上查了这个代码,没有用啊
Dim mouse_x As Single
Dim mouse_y As Single
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
mouse_x = 0
mouse_y = 0
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)
If Button = 1 Then
Me.Left = Me.Left + (X - mouse_x)
Me.Top = Me.Top + (Y - mouse_y)
End If
End Sub 展开
展开全部
Dim md As Boolean, op As Point
Private Sub Form1_MouseDown(sender As Object, e As MouseEventArgs) Handles Me.MouseDown
md = True
op = e.Location
End Sub
Private Sub Form1_MouseMove(sender As Object, e As MouseEventArgs) Handles Me.MouseMove
If md Then
Me.Location = New Point(Me.Left + e.X - op.X, Me.Top + e.Y - op.Y)
End If
End Sub
Private Sub Form1_MouseUp(sender As Object, e As MouseEventArgs) Handles Me.MouseUp
md = False
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询