Click to See Complete Forum and Search --> : Progress Bar


BMLekki
April 26th, 2001, 06:54 PM
Is it possable to put a progress bar in the status bar?

Sharathms
April 27th, 2001, 02:56 AM
I think You can. using the API SetParent. i have seen an example of progressbar in toolbar.
Sharath

Sharathms
April 27th, 2001, 03:38 AM
There is an example in
http://www.mvps.org/vb/
by Karl E. Peterson
cheers
Sharath

Iouri
April 27th, 2001, 07:07 AM
'NOTE: Project Needs to reference
' Microsoft Windows Common Controls
' Microsoft Windows Common Controls 2

'on the form Progr Bar, Timer, Status Bar (sbMain - 3 panels (go to prperties) )

Private Sub Form_Paint()
Dim BdrWth As Single
ScaleMode = vbTwips

'Determine Border Width - May need to be adjusted if a different border style is used
BdrWth = (Width - ScaleWidth) / 4

'Position status bar - "Output" is the Panel Key we want to draw on top of
pbProgress.Move sbMain.Panels("Output").Left, sbMain.Top + BdrWth, sbMain.Panels("Output").Width, sbMain.Height - BdrWth
End Sub


Private Sub Timer1_Timer()
'Increment Progress Value. - Reset at max
pbProgress.Value = IIf(pbProgress.Value = pbProgress.Max, pbProgress.Min, pbProgress.Value + 1)

'Set Default Timer Interval
Timer1.Interval = 1

'Update Display based on progress position
Select Case pbProgress.Value
Case pbProgress.Min:
'Just Begining
sbMain.Panels("Message").Text = "Start"
Timer1.Interval = 1000 'Longer delay
pbProgress.Visible = Not pbProgress.Visible 'Toggle Graphic/Text version each cycle

Case pbProgress.Max:
'Finishing
sbMain.Panels("Message").Text = "Done"
Timer1.Interval = 1000 'Longer delay
Case Else:

'Somewhere in the middle - Calculate Range
sbMain.Panels("Message").Text = CInt(100 * (pbProgress.Value - pbProgress.Min) / (pbProgress.Max - pbProgress.Min)) & "% Complete"
End Select

'Update Text on Panel - Wont see it unless status bar is not visible
sbMain.Panels("Output").Text = "Now showing text instead : " & sbMain.Panels("Message").Text
End Sub


Iouri Boutchkine
iouri@hotsheet.com