A Quick Explorer-Like Interface

A Quick Explorer-Like Interface

Although the new VB5 Application Wizard can build a shell application with an Explorer-like interface, it is often desirable to drop a quick Explorer form into your code without the toolbar or the extra code included by the wizard. You can use only three controls to create a form quickly with the Explorer split-panel look and feel.

To get an Explorer interface up and running, drop a picture box onto a form and set the BorderStyle property to zero (none). Add two controls to the picture box. These controls will represent the left and right panels. Drop in this code:

 Private Sub Form_Resize()	' Optionally, resize manually if you don't 	' want container to cover entire form and 	' resize with form.	Picture1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeightEnd SubPrivate Sub Picture1_Resize()	Dim offset As Integer	Static percent As Single	offset = 4 * Screen.TwipsPerPixelX	If percent = 0 Then		percent = 0.5Else		percent = (Text1.Width + offset) / _			Picture1.Width	End If	Text1.Top = 0	Text1.Left = 0	Text1.Width = Picture1.Width * percent - offset	Text1.Height = Picture1.Height	Text2.Top = 0	Text2.Left = Text1.Width + offset	Text2.Width = Picture1.Width - Text2.Left	Text2.Height = Picture1.HeightEnd SubPrivate Sub Picture1_MouseMove(Button As _	Integer, Shift As Integer, X As Single, _	Y As Single)	Dim offset As Integer, pwidth As Integer	offset = 2 * Screen.TwipsPerPixelX	pwidth = Picture1.Width	If Button = vbLeftButton And X > 20 * _		offset And X < pwidth - 20 * offset Then		Text1.Width = X - offset	ElseIf X < 20 * offset Then		Text1.Width = 19 * offset	ElseIf X > pwidth - 20 * offset Then		Text1.Width = pwidth - 19 * offset	End If	Text2.Left = Text1.Width + 2 * offset	Text2.Width = pwidth - Text2.LeftEnd Sub

In this example, I used two multiline text boxes with scrollbars, but TreeView and ListView controls work just as well.

See also  Essential Measures for Safeguarding Your Digital Data

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist