Results 1 to 4 of 4

Thread: Splitter Bar

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    2

    Post

    How do you create a horizontal resizing splitter bar? Im using a treeview and a listview control and I have the treeview ontop of the listview and I want to be able to resize either one and still have every thing proportional? Any help would be great!

    ~~~~

  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461

    Post

    I dont know if there is a control for that :-)

    But what you can do instead is place an object (maybe a frame that has a height of 10) and then change the cursor when the mouse is over it (an attribute of most objects) and then add a "mousedown" event such that moving the mouse uses the current mouse position to set the following :

    Height of Top View - Shrinking or growing
    Top of Seperator - It gets moved up or down
    Top of Bottom View - You want the top to stay under
    Height of Bottom View - You want the bottom to remain still

    See how that works

  3. #3
    Lively Member
    Join Date
    Mar 2000
    Posts
    66

    Post How to create a horizontal resizing splitter bar

    First of all, in your form, you have to create 2 new controls :

    imgSplitter (image) borderstyle=0 height=200
    picSplitter (picture) visible=false height=120 backcolor=GREY

    Here is an example with 2 listview controls (lvw1 and lvw2 in the same form) :


    Private Sub Form_Resize()
    If WindowState <> 1 Then SizeControls imgSplitter.Top
    End Sub


    Private Sub imgSplitter_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    With imgSplitter
    picSplitter.Move .Left, .Top, .Width - 20, .Height \ 2
    End With
    picSplitter.Visible = True
    picSplitter.ZOrder
    mbMoving = True
    End Sub

    Private Sub imgSplitter_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim sglPos As Single

    If mbMoving Then
    sglPos = Y + imgSplitter.Top
    If sglPos < sglSplitLimit Then
    picSplitter.Top = sglSplitLimit
    ElseIf sglPos > Me.Height - sglSplitLimit Then
    picSplitter.Top = Me.Height - sglSplitLimit
    Else
    picSplitter.Top = sglPos
    End If
    End If
    End Sub

    Private Sub imgSplitter_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    SizeControls picSplitter.Top
    picSplitter.Visible = False
    mbMoving = False
    End Sub


    Private Sub lvw1_DragDrop(Source As Control, X As Single, Y As Single)
    If Source = imgSplitter Then SizeControls Y
    End Sub

    Public Sub SizeControls(Y As Single)

    On Error Resume Next

    If Y < 2000 Then Y = 2000
    If Y > (MainForm.Height - 2000) Then Y = MainForm.Height - 2000
    MainForm.lvw1.Height = Y - 500
    MainForm.imgSplitter.Top = Y
    MainForm.lvw2.Top = Y + 40
    MainForm.lvw2.Height = MainForm.Height - 800 - MainForm.lvw1.Height - MainForm.tlBar.Height - MainForm.stBar.Height

    End Sub

    Good luck,
    Thierry Demoy

    (soory for my approximative english)


  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    2

    Post Thanks

    Thanks, for the replies Gen-X and tdemoy your suggestions and sample code have helped!!

    Thanks
    ~~~~

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