Solved

I need help on a picture box

Posted on 1998-10-28
1
133 Views
Last Modified: 2010-04-30
I need to know how to use a picture box as a status/progress bar...
if some one can help me plz email me @ desel@bigfoot.com
some sample code would be appreciated...
DJK
0
Comment
Question by:djk2000
1 Comment
 

Accepted Solution

by:
tkdcal earned 20 total points
Comment Utility
Create a form with a command button and two picture controls. Paste the following code
into your project to see progress bars made from picture controls.

Private Sub Command1_Click()
   
    Call init_bar(Picture1, 0) 'Make a picture box for horizontal control and then call this
    Call init_bar(Picture2, 1) ' Make a picture box for vertical control and then call this
   
   
    For i = 0 To 100 'Go from 0 to 100 percent
        Call update_bar(Picture1, i, QBColor(4), 0) ' Update the horizontal bar
        Call update_bar(Picture2, i, QBColor(5), 1) ' Update the vertical bar
        For n = 1 To 300: DoEvents: Next n 'wait for a little while
       
    Next i
   
    For i = 100 To 0 Step -1 'Go from 100 percent to 0
        Call update_bar(Picture1, i, QBColor(4), 0) 'Update the horizontal bar
        Call update_bar(Picture2, i, QBColor(5), 1) 'Update the vertical bar
        For n = 1 To 300: DoEvents: Next n 'wait for a little while
    Next i
   
End Sub

Private Sub Form_DblClick()
    End
End Sub

Sub update_bar(bar As Control, percent As Variant, color As Variant, orientation As Variant)

    bar.Cls 'Clear out the picture
    If orientation = 0 Then 'draw the horizontal Bar
        bar.Line (0, 0)-(percent, bar.ScaleHeight), color, BF
    Else 'draw the vertical Bar
        bar.Line (0, 100 - percent)-(bar.ScaleWidth, 100), color, BF 'Draw it backwards
    End If
   
End Sub
Sub init_bar(bar As Control, orientation As Variant)

    bar.ScaleMode = 0 'Set scale mode to user
    If orientation = 0 Then 'Horizontal Bar Graph
        bar.ScaleWidth = 100
    Else 'Vertical Bar Graph
        bar.ScaleHeight = 100
    End If

End Sub

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now