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


Harini
July 17th, 2001, 10:29 AM
Hello,

Can we place place the Progress Bar in a Status Bar on a MDI application's main form? If so, please give me the way to do it.


Thanks
Harini

shree
July 17th, 2001, 10:58 AM
You place the status bar and the progress bar as they will stay aligned to the bottom and top respectively. This code will place the progress bar on the status bar.


private Declare Function SetParent Lib "user32" (byval hWndChild as Long, byval hWndNewParent as Long) as Long
private Sub MDIForm_Load()
SetParent ProgressBar1.hWnd, StatusBar1.hWnd
ProgressBar1.Value = 50
ProgressBar1.Top = 0
End Sub

Harini
July 17th, 2001, 11:33 AM
How can I place this progress bar into one of the panels of the Status bar?

Thanks
Harini

shree
July 17th, 2001, 11:45 AM
The usual procedure is to set the align property of the control you want to place on the status bar (in this case the progress bar) to vbAlignNone, and then set the left and top properties accordingly. But the progress bar did not leave its vbAlignTop value, so I had to work out an workaround.

Place your progress bar in a picture box on the MDI form. Now, use Setparent to position this picturebox on the status bar.


private Declare Function SetParent Lib "user32" (byval hWndChild as Long, byval hWndNewParent as Long) as Long


private Sub MDIForm_activate()
SetParent Picture1.hWnd, StatusBar1.hWnd
ProgressBar1.Value = 50
Picture1.Align = 0
Picture1.Top = 0
Picture1.Left = StatusBar1.Panels(2).Left
Picture1.Width = StatusBar1.Panels(2).Width
End Sub

private Sub Picture1_Resize()
ProgressBar1.Width = Picture1.ScaleWidth
End Sub