Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: VB5,VB6
Expertise: beginner
Apr 7, 2001



Building the Right Environment to Support AI, Machine Learning and Deep Learning

MoveProgressBarIntoPanel - Move a ProgressBar inside a StatusBar's panel

' Move and resize a ProgressBar control so that it fits inside
' a StatusBar's Panel.
' The last argument is the panel index (one-based).

Sub MoveProgressBarIntoPanel(pb As ProgressBar, sb As StatusBar, _
    pnlIndex As Integer)
    Dim deltaY As Single, pnl As Panel, y As Single
    ' account for two pixels around each panel
    deltaY = pb.Parent.ScaleY(2, vbPixels, vbTwips)
    Set pnl = sb.Panels(pnlIndex)
    pnl.Bevel = sbrNoBevel
    ' It is necessary to evaluate the Y coordinate in this way because
    ' if this routine is invoked from Form_Resize you can't rely on
    ' the StatusBar's or Panel's Top property, which still has to be updated.
    y = pb.Parent.ScaleHeight - sb.Height
    ' Move the progress bar in position, and in front of the status bar.
    pb.Move pnl.Left, y + deltaY, pnl.Width, sb.Height - deltaY
    pb.Visible = True
End Sub
Francesco Balena
Comment and Contribute






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



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