VS 2010 [RESOLVED] Custom ProgressBars / Fill Image-VBForums
Results 1 to 6 of 6

Thread: [RESOLVED] Custom ProgressBars / Fill Image

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2010
    Posts
    121

    Resolved [RESOLVED] Custom ProgressBars / Fill Image

    Hey all,

    does anyone know how to go about using an image to 'fill' a progress bar instead of the stock standard green thing? I would also greatly appreciate a solution to using and image as the background of a progress bar aswell!

    Thanks,
    Josh

  2. #2
    PowerPoster kevininstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    5,696

    Re: Custom ProgressBars / Fill Image

    Quote Originally Posted by jduncanator View Post
    Hey all,

    does anyone know how to go about using an image to 'fill' a progress bar instead of the stock standard green thing? I would also greatly appreciate a solution to using and image as the background of a progress bar aswell!

    Thanks,
    Josh
    Wonder on over to Code Project for a nice progressbar that does allow among other things a background image. Build the project then add the control to your toolbox

    To try it out place the control on a form, add a timer, use the code below which does an never-ending demo with text displayed in the control showing percent done.

    Code:
    Public Class Form1
        Private CurrentPosition As Integer = 0
        Private PositionValue As Integer = -1
        Private Sub Form1_Load() Handles MyBase.Load
            CurrentPosition = Progressbar1.Position
        End Sub
    
        Private Sub Timer1_Tick() Handles Timer1.Tick
            If CurrentPosition = Progressbar1.PositionMax Then
                PositionValue = -1
            Else
                If CurrentPosition = Progressbar1.PositionMin Then
                    PositionValue = 1
                End If
            End If
            CurrentPosition += PositionValue
    
            Progressbar1.Text = String.Concat(CurrentPosition.ToString(), " percent done")
    
            Progressbar1.Position = CurrentPosition
    
        End Sub
    
        Private Sub Button1_Click() Handles Button1.Click
            Timer1.Enabled = Not Timer1.Enabled
        End Sub
    End Class
    Very easy to configure the UI in the IDE too.
    http://www.codeproject.com/KB/cpp/XpProgressBar.aspx

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2010
    Posts
    121

    Re: Custom ProgressBars / Fill Image

    I have seen this, but as the name states 'XP' I was sceptical about whether it would work on Vista and Win7?

    Josh

  4. #4
    PowerPoster kevininstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    5,696

    Re: Custom ProgressBars / Fill Image

    Quote Originally Posted by jduncanator View Post
    I have seen this, but as the name states 'XP' I was sceptical about whether it would work on Vista and Win7?

    Josh
    I see no reason (after going thru the source code) why this progressbar would not work on Windows 7 as the code does nothing dependent on any one OS. I use it on Windows Vista, do not have Windows 7 to test it with.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Apr 2010
    Posts
    121

    Re: Custom ProgressBars / Fill Image

    Thanks! The only reason I thought this might not work is the demo program didn't do anything, aswell as the new Aero and visual display effects differs from XP to Vista/7 but if it works in Vista it should theoretically work in Win7!

    Thanks again,
    Josh

  6. #6
    PowerPoster kevininstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    5,696

    Re: Custom ProgressBars / Fill Image

    Quote Originally Posted by jduncanator View Post
    Thanks! The only reason I thought this might not work is the demo program didn't do anything, aswell as the new Aero and visual display effects differs from XP to Vista/7 but if it works in Vista it should theoretically work in Win7!

    Thanks again,
    Josh
    It works fine on Vista, do not have Win7 so if it does not work I can not imagine it would take much to make the ProgressBar to work.

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.