• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 151
  • Last Modified:

I need help on a picture box

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
djk2000
Asked:
djk2000
1 Solution
 
tkdcalCommented:
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now