Click to See Complete Forum and Search --> : Verticle Window Seperator in VB


Atlantisoft
February 28th, 2000, 03:31 PM
In VB, along the left side of the properties window, there's the feature of slider that window bigger and smaller, by moving it to the left. I used an API spi and it shows it's a "VBSlider" made by VB6.exe, Anyone know how i can make one? I need to make my program able to slide a window part back and forth

Johnny101
February 28th, 2000, 03:57 PM
there was post for this exact thing a couple of weeks ago. you should be able to search for it in this forum and get the results. It involved using a picture box as the splitter. it worked pretty well. Or you can "mis-use" the coolbar control (brought to my attention by Lothar) to do this. Add a tool bar control to your form. then draw one control on each band (but only use two bands). then in the custom properties of the coolbar, set the child to the control you drew on each band. also make sure that the "NewRow" (or new line) check box is NOT checked. then you can set the size of one of the bands. hit F5 and see what happens.

HTH,
John

John Pirkey
MCSD
www.ShallowWaterSystems.com

chem1
February 28th, 2000, 10:14 PM
Dear Jhonny,
The problem I am having using this "Cheating Technique" with the collbar is that When I add Tree View and List Viwe controlas and make them children of the coolbar ,the coolbar does not resize itself according to the size of the TV or LV controls. I have also tried checking off NewRow Property but it oes not seem to help,
Thankx in Advance...

Johnny101
February 29th, 2000, 11:42 AM
I played around with it for a while and this what I came up with:

option Explicit
Dim bFirstLoad as Boolean

private Sub CoolBar1_HeightChanged(byval NewHeight as Single)
'to avoid an endless loop, we have to check a few things.
If NewHeight > (me.Height + 700) then Exit Sub
If CoolBar1.Bands(1).MinHeight + 60 = NewHeight then Exit Sub

With CoolBar1
.Bands(1).MinHeight = NewHeight
.Bands(1).Child.Height = .Bands(1).Height
.Bands(2).MinHeight = NewHeight
.Bands(2).Child.Height = .Bands(2).Height

.Width = me.Width - 300
End With
End Sub

private Sub Form_Activate()
Call CoolBar1_HeightChanged(me.Height - 700)
End Sub

private Sub Form_Load()
bFirstLoad = true
With CoolBar1
set .Bands(1).Child = TreeView1
set .Bands(2).Child = ListView1
.Top = 100
.Left = 50
.Height = me.Height - 700
.Width = me.Width - 300
End With
End Sub

private Sub Form_Resize()
'the first time, the controls arent available yet so bypass this
If bFirstLoad then
bFirstLoad = false
Exit Sub
End If
Call CoolBar1_HeightChanged(me.Height - 700)
End Sub





It seemed to work okay for me.

To use this, place a coolbar on the form, draw a treeview on the first band and a list view on the second band. leave the names the default names. Hit F5 and start resizing the form. the bands should resize as well as their respective child controls.

good luck,
John


John Pirkey
MCSD
www.ShallowWaterSystems.com

Lothar Haensler
March 1st, 2000, 02:33 AM
there is downloadable sample of a split control with sourcecode at http://www.attrib.com/source/default.asp?sample=splitbars