Floating toolbar

  • Thread starter Thread starter Nathan
  • Start date Start date
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?
 
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>
 
* "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>
 
Back
Top