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
Printable View
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
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
How can I place this progress bar into one of the panels of the Status bar?
Thanks
Harini
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