Solved

I need help on a picture box

Posted on 1998-10-28
1
146 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

738 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