Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB
Expertise: Beginner
Apr 4, 2006

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, Y
If 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.

Liam Goodacre
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap