Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Split a Fom in two resizable sections.

Status
Not open for further replies.

rguia

Programmer
Oct 19, 2001
6
0
0
US
Any ideas to implement a line to split a Form in two parts and be able to adjust the size of these two sections by draging the line up and down. by the way, i can use only the components that come with VB6.0 (no additional library).

Interesting challenge isn't it?


Rguia
 
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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top