devxlogo

Move a Title-less Form

Move a Title-less Form

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.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist