dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 31, 1998

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


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.ScaleHeight
End Sub
Private Sub Picture1_Resize()
	Dim offset As Integer
	Static percent As Single

	offset = 4 * Screen.TwipsPerPixelX
	If percent = 0 Then
		percent = 0.5
Else
		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.Height
End Sub
Private 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.Left
End Sub

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

David Grantier
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date