Private Const SPLITTER_HEIGHT = 40
' The percentage occupied by the first PictureBox.
Private Percentage1 As Single
' True when we are dragging the splitter.
Private Dragging As Boolean
' Arrange the controls on the form.
Private Sub ArrangeControls()
Dim hgt1 As Single
Dim hgt2 As Single
' Don't bother if we're iconized.
If WindowState = vbMinimized Then Exit Sub
hgt1 = (ScaleHeight - SPLITTER_HEIGHT) * Percentage1
Picture1.Move 0, 0, ScaleWidth, hgt1
hgt2 = (ScaleHeight - SPLITTER_HEIGHT) - hgt1
Picture2.Move 0, hgt1 + SPLITTER_HEIGHT, ScaleWidth, _
hgt2
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As _
Integer, X As Single, Y As Single)
Dragging = True
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As _
Integer, X As Single, Y As Single)
If Not Dragging Then Exit Sub
Percentage1 = Y / ScaleHeight
If Percentage1 < 0 Then Percentage1 = 0
If Percentage1 > 1 Then Percentage1 = 1
ArrangeControls
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As _
Integer, X As Single, Y As Single)
Dragging = False
End Sub
|