CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2000
    Location
    America
    Posts
    130

    Verticle Window Seperator in VB

    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


  2. #2
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: Verticle Window Seperator in VB

    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
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

  3. #3
    Join Date
    Aug 1999
    Location
    Pakistan
    Posts
    366

    Re: Verticle Window Seperator in VB

    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...


  4. #4
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: Verticle Window Seperator in VB

    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
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

  5. #5
    Join Date
    May 1999
    Posts
    3,332

    Re: Verticle Window Seperator in VB

    there is downloadable sample of a split control with sourcecode at http://www.attrib.com/source/default...mple=splitbars



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured