CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Progress Bar

  1. #1
    Join Date
    Apr 2001
    Posts
    29

    Progress Bar

    Is it possable to put a progress bar in the status bar?


  2. #2
    Join Date
    Aug 1999
    Location
    Bangalore, INDIA
    Posts
    70

    Re: Progress Bar

    I think You can. using the API SetParent. i have seen an example of progressbar in toolbar.
    Sharath


  3. #3
    Join Date
    Aug 1999
    Location
    Bangalore, INDIA
    Posts
    70

    Re: Progress Bar

    There is an example in
    http://www.mvps.org/vb/
    by Karl E. Peterson
    cheers
    Sharath


  4. #4
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Progress Bar

    'NOTE: Project Needs to reference
    ' Microsoft Windows Common Controls
    ' Microsoft Windows Common Controls 2

    'on the form Progr Bar, Timer, Status Bar (sbMain - 3 panels (go to prperties) )

    Private Sub Form_Paint()
    Dim BdrWth As Single
    ScaleMode = vbTwips

    'Determine Border Width - May need to be adjusted if a different border style is used
    BdrWth = (Width - ScaleWidth) / 4

    'Position status bar - "Output" is the Panel Key we want to draw on top of
    pbProgress.Move sbMain.Panels("Output").Left, sbMain.Top + BdrWth, sbMain.Panels("Output").Width, sbMain.Height - BdrWth
    End Sub


    Private Sub Timer1_Timer()
    'Increment Progress Value. - Reset at max
    pbProgress.Value = IIf(pbProgress.Value = pbProgress.Max, pbProgress.Min, pbProgress.Value + 1)

    'Set Default Timer Interval
    Timer1.Interval = 1

    'Update Display based on progress position
    Select Case pbProgress.Value
    Case pbProgress.Min:
    'Just Begining
    sbMain.Panels("Message").Text = "Start"
    Timer1.Interval = 1000 'Longer delay
    pbProgress.Visible = Not pbProgress.Visible 'Toggle Graphic/Text version each cycle

    Case pbProgress.Max:
    'Finishing
    sbMain.Panels("Message").Text = "Done"
    Timer1.Interval = 1000 'Longer delay
    Case Else:

    'Somewhere in the middle - Calculate Range
    sbMain.Panels("Message").Text = CInt(100 * (pbProgress.Value - pbProgress.Min) / (pbProgress.Max - pbProgress.Min)) & "% Complete"
    End Select

    'Update Text on Panel - Wont see it unless status bar is not visible
    sbMain.Panels("Output").Text = "Now showing text instead : " & sbMain.Panels("Message").Text
    End Sub


    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured