非标题区域拖动窗体VB
2021-03-12 14:33
标签:top div bsp 需要 lse class The single 标题栏 窗体空白区域按下鼠标左键即可任意拖动窗体,不需要拖动标题栏。 非标题区域拖动窗体VB 标签:top div bsp 需要 lse class The single 标题栏 原文地址:https://www.cnblogs.com/chenxiehan/p/12585337.htmlDim MoveScreen As Boolean
Dim MousX As Integer
Dim MousY As Integer
Dim CurrX As Integer
Dim CurrY As Integer
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
MoveScreen = True
MousX = X
MousY = Y
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If MoveScreen Then
CurrX = Form1.Left - MousX + X
CurrY = Form1.Top - MousY + Y
Form1.Move CurrX, CurrY
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
MoveScreen = False
End Sub