Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
TitleDisplay a progress bar inside a status bar on an MDI form
DescriptionThis example shows how to display a progress bar inside a status bar on an MDI form in Visual Basic 6. The program includes a PictureBox on thue MDI parent and places other controls inside the PictureBox.
KeywordsProgressBar, progress bar, StatusBar, status bar, MDI
CategoriesTips and Tricks, Controls
 
The program makes a phoney status bar by placing a PictureBox with Align property set to "2 - Align Bottom" on the MDI parent form. You can place any controls you like inside this one, including a progress bar. In this example, the PictureBox contains three other PictureBoxes used as panels. Two of those contain a StatusBar and a Label that shows the current time.

The most interesting code in this example resizes the panel PictureBoxes when the picStatus PictureBox resizes.

 
' Resize the panels inside.
Private Sub picStatus_Resize()
Const GAP = 30
Dim hgt As Single

    hgt = picStatus.Height - 2.5 * GAP

    ' Panel3 and time label.
    picPanel3.Move _
        picStatus.ScaleWidth - GAP - picPanel3.Width, _
        GAP, picPanel3.Width, hgt
    lblTime.Move 0, _
        (picPanel3.ScaleHeight - lblTime.Height) / 2, _
        picPanel3.ScaleWidth

    ' Panel2 and progress bar.
    picPanel2.Move _
        picPanel3.Left - GAP - picPanel2.Width, _
        GAP, picPanel2.Width, hgt
    pbTaskProgress.Move 0, 0, _
        picPanel2.ScaleWidth, picPanel2.ScaleHeight

    ' Panel1.
    picPanel1.Move GAP, GAP, _
        picPanel2.Left - 2 * GAP, hgt
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated