How do I draw a progress bar and an icon into the status bar control?
Printable View
How do I draw a progress bar and an icon into the status bar control?
For an icon, just use the Picture property. Unless you are talking about an *icon*, like .ico, which I don't know if it supports as I only use BMPs in StatusBars.
Don't think you can do a statusbar with a progress bar in it unless you chuck a picturebox or something on top of it and ZOrder it.
You can use the SetParent API to make the Statusbar the container for the Progressbar, i.e.VB Code:
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long Private Sub Form_Load() StatusBar1.Panels.Add , "ICON", , , LoadPicture("C:\Program Files\Microsoft Visual Studio\Common\Graphics\Icons\Misc\Face02.ico") ProgressBar1.Move 0, 24, StatusBar1.Panels(1).Width, StatusBar1.Height - 24 SetParent ProgressBar1.hWnd, StatusBar1.hWnd ProgressBar1.Value = 50 End Sub
for the icon, can it be changed to an animated gif?
ei you could add an image list and loop through them to simulate an animated icon.
VB Code:
Dim Counter As Integer Private Sub Timer1_Timer() Counter = Counter + 1 StatusBar1.Panels(3).Picture = ImageList1.ListImages(Counter).Picture If Counter > ImageList1.ListImages.Count - 1 Then Counter = 0 End Sub
I can't say I think an animated icon in a status bar would look professional.