|
-
Oct 5th, 2000, 11:51 AM
#1
Thread Starter
New Member
Does anyone know if you can change the color of the progressbar from that lovely shade of blue to another color?
And is it possible to make it move from right to left instead of left to right?
Just curious...thanks
-
Oct 5th, 2000, 12:06 PM
#2
_______
<?>
'you could make your own..the right to left I've never tried
Code:
'use a progress bar
'make a standard app and add a picture box called Progress
'in the PublicSub DoProgress..rename the frmSaveApps to your form name
'cut and paste the code and run to see an example
'
'<<<<<<< Put this in a bas module >>>>>>>>
'replace frmTips with the name of your app form
'or name your form frmTips for this example
Option Explicit
'number of things to do ex..files to be backed up
Public intCounted#
'
Public Sub DoProgress(Percent)
'
' Percent is % of graph
'
Dim Work As Integer
Dim Num As String
'
Work = Int(Abs(Percent))
If Work > 100 Then Work = 100
'
With frmSaveTips.Progress '<<< With application form
.BackColor = vbWhite '<<< White background
If Not .AutoRedraw Then '<<< picture in memory ?
.AutoRedraw = True '<<< make one
End If
.Cls '<<< clear picture in memory
.ScaleWidth = 100 '<<< new scalemodus
.DrawMode = 10 '<<< not XOR Pen Modus
Num = Format$(Work, "###") + "% Completed"
.CurrentX = 50 - .TextWidth(Num) / 2 '<<< %age is Centered
.CurrentY = (.ScaleHeight - .TextHeight(Num)) / 2
frmSaveTips.Progress.ForeColor = vbBlack '<<< Black text
frmSaveTips.Progress.Print Num '<<< print percent
frmSaveTips.Progress.Line (0, 0)-(Work, .ScaleHeight), vbBlue, BF
.Refresh '<<< show
End With
'
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' <<<<<<<<<<<< event code for form >>>>>>>>>>>>>>>>>>>
Private Sub Command1_Click()
intTotalCount = 1000 'whatever..use 1000 for this example
'print the line & increment the count
Dim i, copied
For i = 1 To 1000
Print "This is a progress bar sample!"
copied = copied + 1 'increment for progress bar
Call DoProgress(copied / intTotalCount * 100) 'progress bar set to 100
Next i
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Oct 5th, 2000, 12:16 PM
#3
Ex-Super Mod'rater
I have a Active X control that does exactly what you have just said.
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Oct 5th, 2000, 12:26 PM
#4
Hyperactive Member
Are you going to share??????
-
Oct 5th, 2000, 12:41 PM
#5
Thread Starter
New Member
Thanks HeSaidjoe,
Never thought of making my own before, I'm relatively new to VB...I wonder if I can modify it to move from right to left...I'll work on that.
And Electroman, if you could send me the Active X control via email to:
[email protected]
I'd appreciate it!!
Or share it here for everyone to see...
Thanks everyone!
-
Oct 5th, 2000, 01:50 PM
#6
Here is how to change the color of a Progressbar:
Code:
Private Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long
Private Const WM_USER = &H400
'Found these only in the COMMCTRL.H file that
'is installed with VC++
Private Const PBM_SETBARCOLOR = WM_USER + 9
Private Const PBM_SETBKCOLOR = &H2000 + 1
Public Function SetPBBackColor(ProgressBar As Object, _
NewColor As OLE_COLOR) As Boolean
On Error Resume Next
Dim lRet As Long
lRet = SendMessage(ProgressBar.hwnd, PBM_SETBKCOLOR, 0&, NewColor)
End Function
Public Function SetPBBarColor(ProgressBar As Object, _
NewColor As OLE_COLOR) As Boolean
On Error Resume Next
Dim lRet As Long
lRet = SendMessage(ProgressBar.hwnd, PBM_SETBARCOLOR, 0&, NewColor)
End Function
'Usage:
SetPBBackColor ProgressBar1, vbRed
-
Oct 5th, 2000, 02:11 PM
#7
Hyperactive Member
Thanx Matt!! Works great and looks good too!!!!!!!!!!!
-
Oct 5th, 2000, 06:17 PM
#8
Thread Starter
New Member
Thanks
Yes, thanks Matthew, I really appreciate it!
-
Oct 7th, 2000, 03:55 AM
#9
Ex-Super Mod'rater
I'll post the control as soon as I can find out where I downloaded it form K ?
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Oct 7th, 2000, 08:09 AM
#10
New Member
Will the examples given work in Excel 97 VBA?
I want to display a progress bar while Excel runs a large macro.
I've tried making one on a UserForm, but it stops the macro running, and I don't know how to make it not modal.
Thanks
Steve
-
Oct 7th, 2000, 02:34 PM
#11
Ex-Super Mod'rater
Try this
www.vbweb.f9.co.uk
Is the address I mentioned that you can get the vbWebProgressBar From.
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Oct 11th, 2000, 11:44 AM
#12
Hyperactive Member
Thank you Electroman! Much appreciated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|