devxlogo

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    pb.ZOrderEnd Sub

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  Seven Service Boundary Mistakes That Create Technical Debt

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.