In this example there is a separation between a TreeView-and a ListView-Component (you can use whatever you want) - handled by a Split-Line (a picturebox).
First of all:
- Split-Line is between the two other controls
- SplitLine is long and very small (height of other controls) !!
- Split-Line has to be DragMode = vbAutomatic
- Dropping of the Line will be registered by the DragDrop-Procedure of Tree- and ListView.
And here is the code:
Private Sub TreeV_DragDrop(Source as Control, X!, Y!)
'Y-coordinate is ignored
ChangeSplitting TreeV.Left + X / Screen.TwipsPerPixelX
end sub
Private Sub ListV_DragDrop(Source as Control, X!, Y!)
ChangeSplitting ListV.Left + X / Screen.TwipsPerPixelX
end sub
Sub ChangeSplitting(X)
'Here, the placement of the forms is handled
'minimum size of 50 pixel
If X < 50 then X = 50
If X > Scalewidth - 50 then X = Scalewidth - 50
TreeV.width = X
Splitline.left = X
ListV.left = Splitline.left + Splitline.width
ListV.width = ScaleWidth - ListV-left
end sub
Annotation:
ChangeSplitting should be called in Form_Load for the first time, to set up an initial-condition.
That should do it
bateman23