Results 1 to 24 of 24

Thread: Vista/7 Style Progress Bar

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2009
    Posts
    76

    Vista/7 Style Progress Bar

    UPDATED: Go down to post 12 for updated version.

    I thought I would post here about a new Vista Style Progress bar that I improved from an older creation be somebody else. The original can be found here. Basically I took the older one and added A Marquee feature, which I believe is not very common in progress bars. I also Added Thresholds That can be set to change the Color of the bar when it surpasses the Threshold. I also added some additional customization features to it. I also plan to add a Text Display on it (I was planning to do that in this version so the Properties are there, but not functional). I am also planning to have only segments of the bar change when it reaches a Threshold. So the Part before the Threshold will be that of the previous Threshold and that after the Threshold will be that of the Threshold. Please feel free to use this in your projects. I also included a sample in the zip. I hope you like it and feel free to leave any suggestions or comments. I tried to post this on codeproject but it got disapproved. (Any Suggestions on how to get an Article approved?)

    Hope You Like It!
    E
    Attached Files Attached Files
    Last edited by Matchlighter; Jul 5th, 2010 at 01:33 PM.

  2. #2
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Vista/7 Style Progress Bar

    You should remove the bin and obj folders from the projects before zipping and attaching to posts.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2009
    Posts
    76

    Re: Vista/7 Style Progress Bar

    Ok, I just got rid of em. May I ask why I should be doing that?

    E

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,927

    Re: Vista/7 Style Progress Bar

    Those folders contain compiled files, which have two problems for things like this.

    The first is the fact that it increases the download size significantly with no benefit - because people can easily re-make the files in a few seconds.

    The other is that the compiled files could contain something malicious, such as if there is a virus on your computer that has infected them.

  5. #5
    Addicted Member
    Join Date
    May 2009
    Posts
    203

    Re: Vista/7 Style Progress Bar

    How do I add this to my project?
    If I reference it it doesn't show upi nthe toolbox, when I add the class to my project I get

    Code:
    Type 'CollectionEditor' is not defined.
    If I then comment it it goes away, but after debugging the form where I placed the progressbar gives an error.
    I ignore and continue it and my form goes blank.

    Am I doing something wrong?

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Nov 2009
    Posts
    76

    Re: Vista/7 Style Progress Bar

    It does not work with .NET 4.0 if that is what you are using. I forgot to upload a fix to that. I will soon though. If you are not using .NET 4.0, add a reference to System.Design.
    If I helped you in any way, please add to my reputation

    Controls:
    Vista/7 Style Progress Bar

  7. #7
    Addicted Member
    Join Date
    May 2009
    Posts
    203

    Re: Vista/7 Style Progress Bar

    That didn't work.
    I also got that error on your project.

    I get this error when starting a new project and building after.
    This shows after the build stops.

    Object of type 'WindowsApplication1.VistaStyleProgressBar.ThresholdItem[]' cannot be converted to type 'WindowsApplication1.VistaStyleProgressBar.ThresholdItem[]'.
    Last edited by vixez; Jun 29th, 2010 at 02:54 PM.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Nov 2009
    Posts
    76

    Re: Vista/7 Style Progress Bar

    I will take a look at the code as soon as I am less busy. Sorry for the inconvenience.
    If I helped you in any way, please add to my reputation

    Controls:
    Vista/7 Style Progress Bar

  9. #9
    Lively Member
    Join Date
    Sep 2009
    Posts
    64

    Re: Vista/7 Style Progress Bar

    Works fine for me and thanks for the nice progress bar


    I have vs 2010 net 4

    I created a new windows form project, targeted at net 3.5. I added to the project an 'existing item' browsed to your class and added it. I got an error of
    Type 'CollectionEditor' is not defined.

    I went to 'My Project' - 'References' and added a net reference to system design. Error message was cleared.

    I built the project and then component was available in the toolbox, which i added to the form and then built the project again, everything works fine.

    I also changed the targeting compile to net 4 and it works fine also

    Thanks again for nice component

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Nov 2009
    Posts
    76

    Re: Vista/7 Style Progress Bar

    I have actually added somethings to it and have not updated it here. I will prepare it for release and upload it. Thanks for your Interest!
    If I helped you in any way, please add to my reputation

    Controls:
    Vista/7 Style Progress Bar

  11. #11
    Addicted Member
    Join Date
    May 2009
    Posts
    203

    Re: Vista/7 Style Progress Bar

    Quote Originally Posted by BobbyP View Post
    Works fine for me and thanks for the nice progress bar


    I have vs 2010 net 4

    I created a new windows form project, targeted at net 3.5. I added to the project an 'existing item' browsed to your class and added it. I got an error of
    Type 'CollectionEditor' is not defined.

    I went to 'My Project' - 'References' and added a net reference to system design. Error message was cleared.

    I built the project and then component was available in the toolbox, which i added to the form and then built the project again, everything works fine.

    I also changed the targeting compile to net 4 and it works fine also

    Thanks again for nice component
    That did the trick, thanks!

    Quote Originally Posted by Matchlighter View Post
    I have actually added somethings to it and have not updated it here. I will prepare it for release and upload it. Thanks for your Interest!
    Nice

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Nov 2009
    Posts
    76

    Re: Vista/7 Style Progress Bar

    Ok! I have got the new one ready! In this release I have add several features:
    • Text on top of progress. Use '%p' to display the value.
    • Block Style with editable size and spacing.
    • Editable Gradient Background.
    • Editable Border Color.


    There should be a screenshot attached now.

    OK, that is all I can think of for the moment. It is Targeted at .NET 4.0 and is a VS2010 project. So I am not sure if it will open or be usable in older versions, but I have heard of a converter or something of the sort.

    If you have any suggestions for the project, let me know!
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by Matchlighter; Oct 28th, 2010 at 06:43 PM. Reason: Added Screenshot
    If I helped you in any way, please add to my reputation

    Controls:
    Vista/7 Style Progress Bar

  13. #13
    Addicted Member
    Join Date
    May 2009
    Posts
    203

    Re: Vista/7 Style Progress Bar

    I just tried it out, working great

  14. #14
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Vista/7 Style Progress Bar

    Can you post a screen shot ?

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  15. #15

    Thread Starter
    Lively Member
    Join Date
    Nov 2009
    Posts
    76

    Re: Vista/7 Style Progress Bar

    Quote Originally Posted by akhileshbc View Post
    Can you post a screen shot ?
    I just attached a Screenshot to post 12 that you can take a look at.
    If I helped you in any way, please add to my reputation

    Controls:
    Vista/7 Style Progress Bar

  16. #16
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Vista/7 Style Progress Bar

    Quote Originally Posted by Matchlighter View Post
    I just attached a Screenshot to post 12 that you can take a look at.
    Super..

    I liked the second one.
    I didn't liked the third one. Maybe the color is giving me this feeling. I didn't run the project yet (but downloaded and keept it in my local CodeBank )

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  17. #17

    Thread Starter
    Lively Member
    Join Date
    Nov 2009
    Posts
    76

    Re: Vista/7 Style Progress Bar

    Quote Originally Posted by akhileshbc View Post
    Super..

    I liked the second one.
    I didn't liked the third one. Maybe the color is giving me this feeling. I didn't run the project yet (but downloaded and keept it in my local CodeBank )
    Mostly, the third one is showing off the block style feature. I tried to make the second one look like the Expression Studio 3 installer one. I apparently did a good job
    If I helped you in any way, please add to my reputation

    Controls:
    Vista/7 Style Progress Bar

  18. #18
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Vista/7 Style Progress Bar

    Quote Originally Posted by Matchlighter View Post
    Mostly, the third one is showing off the block style feature. I tried to make the second one look like the Expression Studio 3 installer one. I apparently did a good job
    Try giving some effects to the blocks. That might work

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  19. #19
    New Member
    Join Date
    Sep 2015
    Posts
    3

    Re: Vista/7 Style Progress Bar

    Hi. I've used this in a project built in Visual Studio 2013, and thought you might like to know that this code includes arithmetic that can cause an exception (arithmetic overflow which happens if MaxValue=MinValue), the exception is horrible at design time, affecting the project stability. The exception happens because there ends up a division by zero.
    I've added code that makes this progressbar do nothing if MaxValue=MinValue; as far as I can tell there are two point in the code where this needs to be caught.
    Perhaps there is a better solution.
    Overall, this a good product.

  20. #20
    New Member
    Join Date
    Mar 2016
    Posts
    3

    Re: Vista/7 Style Progress Bar

    Quote Originally Posted by proberts5 View Post
    Hi. I've used this in a project built in Visual Studio 2013, and thought you might like to know that this code includes arithmetic that can cause an exception (arithmetic overflow which happens if MaxValue=MinValue), the exception is horrible at design time, affecting the project stability. The exception happens because there ends up a division by zero.
    I've added code that makes this progressbar do nothing if MaxValue=MinValue; as far as I can tell there are two point in the code where this needs to be caught.
    Perhaps there is a better solution.
    Overall, this a good product.
    Sorry to resurrect an old thread...
    I've got the bar installed and appears to be functioning correctly, I'm updating it with the code:

    Code:
        
    Private Sub ProgressBar(Total As Integer, Counter As Integer, Title As String, FileName As String)
            Dim Percent As Integer = (Counter / Total) * 100
            MsVistaProgressBar1.Visible = True
            MsVistaProgressBar1.Value = Percent
            If Title = "Checking: " Or Title = "Getting References: " Then
                MsVistaProgressBar1.DisplayText = Title & " " & FileName
            Else
                MsVistaProgressBar1.DisplayText = Title & " " & FileName & " " & Percent & "%"
            End If
    
        End Sub
    But it doesn't seem to update during runtime. I've tried other controls which do update, but for some reason this doesn't
    any advice?

  21. #21
    New Member
    Join Date
    Sep 2015
    Posts
    3

    Re: Vista/7 Style Progress Bar

    Make sure you first define the range for the Progressbar; for percent MsVistaProgressBar1.MinValue=0,MsVistaProgressBar1.MaxValue=100.
    Then set MsVistaProgressBar1.value=<a value between MsVistaProgressBar1.MinValue and MsVistaProgressBar1.MaxValue> in your code somewhere.
    You may wish to validate the Counter in your routine to make sure it's >=0 and <= Total.
    Also that Total <>0 to avoid arithmetic overflow.
    Last edited by proberts5; Mar 21st, 2016 at 08:46 AM.

  22. #22
    New Member
    Join Date
    Mar 2016
    Posts
    3

    Re: Vista/7 Style Progress Bar

    (you'll have to pardon my ignorance I'm completely self taught)

    I double checked the values and everything is correct. But I did some changes that may give more info.

    I originally wrote the program as a Windows Form Application, but because I wanted to integrate it into Inventor, I changed it to a Class Library and changed the start action to open the Inventor program. The first time the progress bar failed and I removed it until I could get the program functioning correctly. When I reinstated the progress bar that's when it wouldn't update,

    So I changed the setup back to a Windows Form that started in my main user form and now the progress bar updates as expected.

    Is there some setting somewhere that disables/enables 3rd party controls in a Class Library application?

  23. #23
    New Member
    Join Date
    Sep 2015
    Posts
    3

    Re: Vista/7 Style Progress Bar

    I'm not aware of anything that disables/enables 3rd party controls; and I'm not familiar with Inventor.
    I have had issues with this progress bar in my Vbproject, though, to the point where I've had to resort to a backup. That's how I know about the gotchas regarding arithmetic overflow (causing an irreparable crash in the project at design time).
    first fix the progress bar code: -

    in the DrawBar routine modify the code: -

    If MaxValue = MinValue Then
    r.Width = CInt((Value * 1.0F / (2) * Me.Width))
    Else
    r.Width = CInt((Value * 1.0F / (MaxValue - MinValue) * Me.Width))
    End If

    and in the DrawMarqueeBar routine: -

    If MaxValue <> MinValue Then
    If CInt((Threshold.ThresholdPosition * 1.0F / (MaxValue - MinValue) * Me.Width)) > LastHiTH _
    And MarqueeCenterPx >= CInt((Threshold.ThresholdPosition * 1.0F / (MaxValue - MinValue) * Me.Width)) _
    And Threshold.ColorizeBar Then
    LastHiTH = CInt((Threshold.ThresholdPosition * 1.0F / (MaxValue - MinValue) * Me.Width))
    MarqeeColor = Threshold.ThresholdColor
    End If
    Else
    LastHiTH = Me.Width
    MarqeeColor = Threshold.ThresholdColor
    End If

    This fixes the points where it crashes when MaxValue=MinValue (i.e. when adjusting the design time parameters).

    your routine should have an error trap and validation checks: -

    Private Sub ProgressBar(Total As Integer, Counter As Integer, Title As String, FileName As String)
    Try

    if MsVistaProgressBar1.MinValue = MsVistaProgressBar1.MaxValue Then Throw New Exception ("ProgressBar scale Error")

    if Total = 0 Then Throw New Exception ("Total cannot be zero")

    Dim Percent As Integer = (Counter / Total) * 100
    if Percent < MsVistaProgressBar1.MinValue Then Throw New Exception ("value under scale")
    if Percent > MsVistaProgressBar1.MaxValue Then Throw New Exception("value over scale")

    MsVistaProgressBar1.Visible = True
    MsVistaProgressBar1.Value = Percent
    If Title = "Checking: " Or Title = "Getting References: " Then
    MsVistaProgressBar1.DisplayText = Title & " " & FileName
    Else
    MsVistaProgressBar1.DisplayText = Title & " " & FileName & " " & Percent & "%"
    End If

    Catch ex as exception
    MsgBox ex.Message
    End Try

    End Sub

  24. #24
    New Member
    Join Date
    Mar 2016
    Posts
    3

    Re: Vista/7 Style Progress Bar

    Thanks for the error corrections in the code.
    In regards to the code not updating, I'm guessing it has something to do with it being running too low in the program hierarchy. I may leave it in for any stand-alone programs, but when you create a class to be run within another program containing this progress-bar that's when the updating seems to be at best intermittent.

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