Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anyone have a solution to display a progressbar in the statusbar? 1

Status
Not open for further replies.

MikeBronner

Programmer
May 9, 2001
756
0
0
US
I would like to display a progressbar in my form's statusbar.
Is there a doable solution to this? Best Regards and many Thanks!
Michael G. Bronner X-)

"Who cares how time advances? I am drinking [beer] today." Edgar Allan Poe
 
yes, it can be done. Here's one way:

You'll need to have placed a ProgressBar on your form, and set it's appearance to ccFlat. You'll also need a StatusBar with at least 1 panel.

You can then call this routine, with pbSource set to your ProgressBar, sbDest set to your Statusbar, and lPanel set to the panle you want to place the Progressbar on top of. I'd place a call to the routine in both the Form_Load and Form_Paint events (Form_Resize won't work, as the Progressbar would get moved before the StatusBar get's painted, thus being hidden). There are still some minor issues to deal with, but this should give you a good starting point

Private Sub PlaceProgress(pbSource As ProgressBar, sbDest As StatusBar, lPanel As Long)
pbSource.Move sbDest.Left + sbDest.Panels(lPanel).Left, sbDest.Top + 3 * Screen.TwipsPerPixelX, sbDest.Panels(lPanel).Width + 1 * Screen.TwipsPerPixelX - 2 * Screen.TwipsPerPixelX, sbDest.Height - 4 * Screen.TwipsPerPixelY
End Sub
 
A quick and easy way to do that is to use a 2 band CoolBar control aligned to bottom, One panel would have the Progress bar as child, the other the StatusBar, it not elegeant, but it will give you the same functionality.
 
Thanks strongm!

I was thinking I might have to do i that way. Thought there might be a direct way (through properties or something, or perhaps another control that I didn't know of) to integrate the two, but I guess not.

Thanks for the help :) Best Regards and many Thanks!
Michael G. Bronner X-)

"Who cares how time advances? I am drinking [beer] today." Edgar Allan Poe
 
strongm,

I played around with your code a bit. However, I never was able to get the progressbar to display on top of the statusbar.

I'm using an MDIForm, and have placed the statusbar in that. I also placed the progressbar in the MDIForm.

I suspect this has to be handled differently in an MDIForm? Best Regards and many Thanks!
Michael G. Bronner X-)

"Who cares how time advances? I am drinking [beer] today." Edgar Allan Poe
 
I always drag the progress bar on the panel I want it to display in, and change it to initially set visible to false, when I need to use the progressbar I just change it visible to true and it always shows up on top of the panel where I placed it.

I adjust the progress bar to be within the panel by just dragging it with the mouse, I've never had to do any fancy code to achieve this.

Hope this helps,
Dale
 
You may also try Progress1.ZOrder after moving it in your code. (At design time, use the Ctrl + J key combination). If you leave off the arguments after the ZOrder call, it places the control in front of all others.

-Mike Difference between a madman and a genius:
A madman uses his genius destructively,
A genius uses his madness constructively.
 
Hi,

what worked for me was to put a PictureBox on my mdiForm, which acts as a container. In this picturebox I put a statusbar and a progressbar, and with this configuration I was able to place the progressbar over the statusbar. All you have to figure out is the width of the panels of the statusbar and the width of the progressbar so that the latter neatly displays inside a panel.

Hokje
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top