Solved

I need help on a picture box

Posted on 1998-10-28
1
138 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
ID: 1442186
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

806 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