devxlogo

Simulate Win95 Taskbar Within Your App

Simulate Win95 Taskbar Within Your App

The Windows 95 taskbar (with the Auto Hide check box set) is quite attractive and provides a compact, nonintrusive way to access and organize information. You can easily simulate this functionality in a VB program and provide a useful alternative to a pull-down menu and/or SpeedButton. To set up such a “taskbar” in your VB application, include a control that can act as a container for other controls in your VB form. The PictureBox control looks good and works well; or you can use a Panel or a Frame.

Set the PictureBox’s Align and AutoSize properties. The Align property indicates where the taskbar will reside on the form, and the AutoSize property ensures that the PictureBox is sized to fit the contours of its parent form whenever the form is resized.

Set the PictureBox’s Visible property to False. Make sure your custom taskbar is not visible until the mouse is moved over a defined “hot” zone on the form. A “hot” zone is a location on the screen defined in X or Y coordinates. You can use these coordinates in any unit of measurement, such as twips or pixels. Set the Parent form’s ScaleMode property to the unit of measurement you wish to work in.

Set the Width and/or Height of the PictureBox to appropriately show embedded controls or information. Set up code in the Form’s MouseMove event to handle the taskbar. This code aligns the taskbar to the left of the screen:

 'Object		Property		Setting'------		--------		-------'Form		Name			FrmTaskBarEx'			ScaleMode	Pixel'PictureBox	Name			PicTaskBar'			Align		Align Left'			AutoSize		True'			Visible		FalsePrivate Sub Form_Load()' Set Width of PictureBox to 1/4 size of Parent form ' when form is loaded. This is wide enough to show ' all of the controls I embedded in the PictureBox,' and will vary with each application.	PicTaskBar.Width = Me.ScaleWidth / 4End SubPrivate Sub Form_MouseMove(Button As _	Integer, Shift As Integer, X As Single, Y As Single)' When the horizontal mouse position is less ' than or equal to defined hot zone' (in this case, horizontal pixel position 4), show taskbar	If (X <= 4) Then 		PicTaskBar.Visible = True		' When the horizontal mouse position is 		' greater than the width of the 		' PictureBox, hide taskbar	ElseIf (X > PicTaskBar.Width) Then		PicTaskBar.Visible = False	End IfEnd Sub
devxblackblue

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