PDA

Click to See Complete Forum and Search --> : toolbox


MrPolite
May 25th, 2002, 09:27 PM
umm, it's kind of a hard question, but plz bear with me :D
I want to have a toolbox for my program that could attatch itself to the main form OR be used as a separate form. Like in MS-Paint, the drawing toolbox is a part of the main form but you can also take it out and it will look like a separate form


how do I make such a thing? any ideas?:confused:

wej42
May 26th, 2002, 11:01 AM
iv seen a tutorial for doin that on vb-world for vb6, not sure bout .NET
but, heres the wrong way of doing it (my way)...
make 2 forms and make the toolbox w/o a border and make it so that
if tool.left <= tool.width +10 then '(basicall if its on the left) then
tool.left = tool.width +10 'lock it onto the left
end if
or instead of making it be tool.width +10 u could do like frmMain.left + tool.width +10 and thatd snap it to the main forms left

anyways, thats what i would do.. im 100% sure theres a easier / more efficient way :)

hope this helps till you get a real way of doin it

wej42
May 26th, 2002, 11:10 AM
ok i was gonna make an app that did this for you, but it turns out it doesnt work to well.. it works, but when you move it, it looks like there are 1000 forms on ur screen till u mouse_up..so, dont do that unless ur desperate :(

MrPolite
May 26th, 2002, 01:06 PM
:D tnx for the effort though ;)

umm, lets see! hmm...
So I can make a second form as my toolbox. the only problem is how to do that SNAPPING thing to attach it to the main form?:confused:

hellswraith
May 26th, 2002, 03:55 PM
You can have a toolbar on the main form that is hidden when the form is showing, and when the form gets within a certain distance, show the toolbar and hide the form at the same time. Also, when the person drags the toolbar away fromt he main form toolbar area the form appears and the toolbar on the main form is set to hidden. It is just a dancing act you have to do to perform it.

MrPolite
May 26th, 2002, 04:00 PM
k, I'll do that :)

wej42
May 27th, 2002, 12:08 PM
theres gotta be an easier way... bill gates is just hiding it from us :)

wej42
May 27th, 2002, 12:12 PM
form2_move
if form2.left <= form1.left + 10 then
timer1.enabled = true
end if
end sub

timer1_tick
form2.left = form1.left + 10
form2.formborderstyle = none 'not the exact code, dont have vb open right now... change the border to look more like a toolbox
end sub

ContextMenuOrButtonOnForm2_click 'some button that undocks the toolbar
timer1.enabled = false
form2.borderstyle = fixedtoolwindow 'not the exact code here either, makes it a normal form again, its close tho
end sub


try that.. that seems to me like it would work (i havent tested it, this is just what i would do.. maybe instead of timer u could use a loop or somethin)

*edit* o ya, and u can do something like this for top/bottom/right also

hope this helps!
-me