简单代码片段,记录一下备用.
Option Explicit
Dim mX As Long, mY As Long
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button And vbLeftButton Then
mX = X
mY = 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 - mX + X, Me.Top - mY + Y
End If
End Sub '
这段VB6代码展示了如何实现一个无边框窗体的拖动功能,通过MouseDown和MouseMove事件处理,使得用户能通过鼠标左键拖动窗体位置。
3815

被折叠的 条评论
为什么被折叠?



