If you’ve struggled with setting static variables in MouseDown, and MouseUp commands to enable users to drag borderless windows around the screen, here’s a simpler way:
If Button = False Then s1.Move X, YIf Button = 1 Then Me.Move Me.Left + (X - s1.Left), Me.Top + (Y - s1.Top)
When you run the form, you’ll see the Shape move around with the mouse before you begin dragging. But as soon as you start dragging, the form moves, while the Shape stays still. Set the Shape’s Visible property to false to make the process invisible to users. Note that, if there are other controls on the form, users have to click on the form’s surface for this scheme to work. In such cases, you should explicitly provide a visual cue so users will know where to “grab” to drag your forms.