blah blah blah is here! blah blah » Close

up0down
link

Hi all,
I have been working with C# for long time but i was try to make the toolbars movable like ones in word and excel and these applications that the user can drag the tool bar and place it wherever he wants
if you know how it is done please tell me.
Thanks in advance

last answered 2 years ago

1 answers

up0down
link

1) you need to make some docking controls. it gives you definate locations to check as the user moves their mouse over them.
2) you have your toolbar which is docked up to one of them.
3) override the winproc function to allow sending the (I cant remember if its the lparam or wparam) window/control a message when the user clicks and drags inside the toolbar area (that doesnt contain a button) that would allow it to be dragged around the form.
4) when you're dragging the toolbar around, you can check to see if the location of your mouse is over one of the "docking" locations and if it is (when the user lets go) the toolbar docks to which ever side your docking panels are.
now dont ask me specifics of how to do it. I've managed to be able to figure out how to move a borderless form around by clicking anywhere on the form and passing the htcaption message to the window, but thats about as far as I've gotten with any thing similar.
you should look at how the docking panels work <a target="_blank" href="http://www.freewebs.com/weifenluo/DockManager.htm">here</a> because you're going to need the same things for your toolbar.

up0down
link

Thanks MadHatter i really appreciate your advice and i'll try to figure out a way to do that i just wanted to know if this is a built in capability in the winforms
thanks again

up0down
link

<a target="_blank" href="http://www.aisto.com/roeder/DotNet/">Here's another</a> free source implementation of a toobar library ("CommandBar") that allows the dragging around of the tobar (I dont think it does docking around the form or lets you tear the toolbar off, but you can take a look at it.

This post was imported from csharpfriends, if you have a similiar question please ask it again.

All previous members have been migrated, hope you enjoy the new platform!

Feedback