Results 1 to 24 of 24

Thread: Vista/7 Style Progress Bar

Hybrid View

  1. #1
    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

  2. #2

    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

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

    Re: Vista/7 Style Progress Bar

    I just tried it out, working great

  4. #4
    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.

  5. #5
    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?

  6. #6
    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.

  7. #7
    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?

  8. #8
    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

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