Floating toolbar

N

Nathan

How can I create a floating toolbar that works something
like a Win Media Player skin. I know how to make a form
remain on top of all other applications, but I need to
allow users to move it around without the title bar or
control box being present. Is it possible to grab part
of the form itself to move it?
 
F

Fergus Cooney

Hi Nathan,

This is from an old VB6 program. It'll show you the method. You may like
to let the form be clicked anywhere or you may designate a 'drag-me' hotspot
instead - such as a PictureBox.

Regards,
Fergus

<code language="VB6">
Dim G_LastX!
Dim G_LastY!

Private Sub Form_MouseDown(MouseButton, ShiftStatus, X!, Y!)
If MouseButton = vbKeyLButton Then
G_LastX! = X!
G_LastY! = Y!
End If
End Sub

Private Sub Form_MouseMove(MouseButton, ShiftStatus, X!, Y!)
If MouseButton = vbKeyLButton Then
If G_LastX! <> X! Or G_LastY! <> Y! Then
dX! = X! - G_LastX!
dY! = Y! - G_LastY!
Me.Left = Me.Left + dX!
Me.Top = Me.Top + dY!
G_LastX! = X!
G_LastY! = Y!
End If
End If
End Sub
</code>
 
H

Herfried K. Wagner [MVP]

* "Nathan said:
How can I create a floating toolbar that works something
like a Win Media Player skin. I know how to make a form
remain on top of all other applications, but I need to
allow users to move it around without the title bar or
control box being present. Is it possible to grab part
of the form itself to move it?

See:

<http://www.google.de/groups?q=sendmessage+HTCAPTION+group:*dotnet*&ie=UTF-8>

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

Improve your quoting style:
<http://learn.to/quote>
<http://www.plig.net/nnq/nquote.html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top