Solved

I need help on a picture box

Posted on 1998-10-28
1
147 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

695 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